Skip to content

Instantly share code, notes, and snippets.

@zAbuQasem
Created April 19, 2023 20:24
Show Gist options
  • Save zAbuQasem/be07335929beec759866dc8d4c9a68b9 to your computer and use it in GitHub Desktop.
Save zAbuQasem/be07335929beec759866dc8d4c9a68b9 to your computer and use it in GitHub Desktop.

Revisions

  1. zAbuQasem created this gist Apr 19, 2023.
    14 changes: 14 additions & 0 deletions LFI-Portscanner.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    # 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}")