LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-11-2018, 07:14 AM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

Rep: Reputation: Disabled
How do you discover which ipset blocklist contains particular IP?


Hello,

how do you discover which ipset blocklist contains particular IP?

Usually when i want to see if some IP is banned by ipset, i do:

ipset list|grep IP

But it do not tell me which ipset blocklist contain this IP.

I can list blocklists: service ipset status

But what is the most simple command that will tell me in which list this IP reside. I need to know it quickly without quering each list (ipset list listname|grep IP), i have many lists..

So far this works, but is not ideal (hard to remember):

for ipset in $(service ipset status|grep "Name:"|awk "{print $2}");do echo $ipset;done|grep -v Name >> ipsetlist
for ipset in $(cat ipsetlist);do echo $ipset && ipset list $ipset|grep IPHERE;done
 
Old 04-11-2018, 08:03 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by postcd View Post
Hello,
how do you discover which ipset blocklist contains particular IP? Usually when i want to see if some IP is banned by ipset, i do:

ipset list|grep IP

But it do not tell me which ipset blocklist contain this IP. I can list blocklists: service ipset status

But what is the most simple command that will tell me in which list this IP reside. I need to know it quickly without quering each list (ipset list listname|grep IP), i have many lists.. So far this works, but is not ideal (hard to remember):
Code:
for ipset in $(service ipset status|grep "Name:"|awk "{print $2}");do echo $ipset;done|grep -v Name >> ipsetlist
for ipset in $(cat ipsetlist);do echo $ipset && ipset list $ipset|grep IPHERE;done
This is another iptables related question, one of the many you've asked over the course of several years here. You never followed up on several of your previous threads here, and are continually reluctant to provide details or answer questions when asked. This other thread about ipset from a year ago is a good example:
https://www.linuxquestions.org/quest...8/#post5765388

Also, this post doesn't make sense; you ask a question, then post the answer to the question. If you have the commands to do what you're after, what else do you need? If you don't want to type them in, then put the command(s) in a file (make a 'script'), and run that. See any of your (many) other threads about how to write a script if needed.
 
Old 04-12-2018, 01:16 AM   #3
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
Yes, that do not solve the issue, for the reason i typed in my first post.
 
Old 04-12-2018, 06:47 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by postcd View Post
Yes, that do not solve the issue, for the reason i typed in my first post.
Again, you are following the same pattern as you've done for years. You are providing no details, and answering no questions when asked.

AGAIN: Why can you not take the commands that you ***SAY ARE ALREADY WORKING***, put them in a script file, and just run it?? Where is the problem there? It would be a single command, followed by an IP address.

AGAIN: You have been asking about iptables/ipset for years now, yet appear to be unable to apply ANYTHING you've learned in that time.
 
Old 04-12-2018, 03:20 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
Members please note this.

Replies should be informational and directly related to the original question.

Replies like you asked that before are not solutions.
 
Old 04-13-2018, 06:54 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by jefro View Post
Members please note this.
Replies should be informational and directly related to the original question.
Indeed; which is exactly why postcd was asked to provide more information, and specifically was asked why (when he posted the solution to the very question he asked), he couldn't use that solution? Putting both of those commands into a small script file and getting the IP address as a command-line argument leaves the OP with a single command to run to find out the answer, doesn't it?
Quote:
Replies like you asked that before are not solutions.
The "Question Guidelines" indicate that showing no effort and not answering questions when asked are not good things, and the OP has displayed this pattern of behavior for numerous years at this point.

I'm sorry to disagree with you here, but asking questions that differ only SLIGHTLY from one to another, indicate the poster shows no effort on applying what they've been told previously.

Last edited by TB0ne; 04-13-2018 at 06:58 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ip blocklist gobinath1989 Linux - Newbie 1 09-27-2012 03:43 PM
Server hacked? My mailserver is on a spam-blocklist crowl Linux - Security 5 07-13-2012 04:10 AM
[SOLVED] squid blocklist help klingoncowboy4 Linux - Server 2 06-09-2011 03:46 AM
squid blocklist saran_sai Linux - Newbie 5 12-08-2008 09:52 AM
reatime or dns blacklist or blocklist how-to elfoozo Linux - Software 4 07-08-2006 01:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration