LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-13-2021, 01:06 AM   #1
michail nav
LQ Newbie
 
Registered: Jul 2021
Posts: 1

Rep: Reputation: Disabled
Scan port through iptables config, that blocks scans.


I need to find port and read info from this port. But there are iptables config, that blocks scans. Can you help to understand how find these port?

first:

Code:
ipset create scanned_ports hash:ip,port family inet hashsize 32768 maxelem 65536 timeout 1

iptables -A INPUT -p tcp -m state --state INVALID -j DROP
iptables -A INPUT -p tcp -m state --state NEW -m set ! --match-set scanned_ports src,dst -m hashlimit --hashlimit-above 1000/hour --hashlimit-burst 1000 --hashlimit-mode srcip --hashlimit-name portscan --hashlimit-htable-expire 10000 -j SET --add-set port_scanners src --exist
iptables -A INPUT -p tcp -m state --state NEW -m set --match-set port_scanners src -j DROP
iptables -A INPUT -p tcp -m state --state NEW -j SET --add-set scanned_ports src,dst


nohup python -mSimpleHTTPServer $_PORT > /dev/null &
second:

Code:
ipset create scanned_ports hash:ip,port family inet hashsize 32768 maxelem 65536 timeout 1

iptables -A INPUT -p tcp -m state --state INVALID -j DROP
iptables -A INPUT -p tcp -m state --state NEW -m set ! --match-set scanned_ports src,dst -m hashlimit --hashlimit-above 1000/hour --hashlimit-burst 1000 --hashlimit-mode srcip --hashlimit-name portscan --hashlimit-htable-expire 10000 -j SET --add-set port_scanners src --exist
iptables -A INPUT -p tcp -m state --state NEW -m set --match-set port_scanners src -j DROP
iptables -A INPUT -p tcp -m state --state NEW -j SET --add-set scanned_ports src,dst

iptables -I INPUT -p tcp --tcp-flags ALL SYN -j REJECT --reject-with tcp-reset --dport $_PORT

nohup python -mSimpleHTTPServer $_PORT > /dev/null &
 
Old 07-15-2021, 11:34 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,409

Rep: Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338Reputation: 2338
Are you trying to hack into your own system, or someone else's?
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
port scans - iptables epoo Linux - Security 9 07-19-2015 12:44 PM
Nessus scan and no port scan possible? memo007 Linux - Security 1 09-08-2008 06:21 PM
Graphical Firewall for Linux with alerts to port scans, etc + interact with IPTABLES doraimom Linux - Security 7 04-15-2007 07:49 PM
How to scan for scans mikeghet Linux - Networking 3 12-29-2005 05:18 AM
Block ping scans (iptables) robeb Linux - Security 9 06-12-2002 03:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:03 AM.

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