Created
April 19, 2023 20:24
-
-
Save zAbuQasem/be07335929beec759866dc8d4c9a68b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Written by zAbuQasem | |
# Usage: cat /proc/net/tcp | awk '{print $2}' |grep -E '[A-F0-9]' | python3 lfi-portscan.py | |
import sys | |
import struct | |
import socket | |
addresses = [i.strip() for i in sys.stdin] | |
for address in addresses: | |
hex_ip,port = address.split(":")[0],address.split(":")[1] | |
hex_ip = struct.pack("<I", int(hex_ip, 16)) | |
ip = socket.inet_ntoa(bytes.fromhex(hex_ip.hex())) | |
port = int(port,16) | |
print(f"{ip}:{port}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment