LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Scan port through iptables config, that blocks scans. (https://www.linuxquestions.org/questions/linux-security-4/scan-port-through-iptables-config-that-blocks-scans-4175697665/)

michail nav 07-13-2021 01:06 AM

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 &


business_kid 07-15-2021 11:34 AM

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


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