Which languages better support raw sockets? -
what languages more appropriate program raw sockets?
packetfu's ruby doesn't have documentation.
i've been using c far wondering if there alternatives.
raw sockets easy in python ( https://docs.python.org/2/library/socket.html, http://bt3gl.github.io/black-hat-python-building-a-udp-scanner.html) , in assembly (http://sock-raw.org/, have adapt code x64 assembly, see 64 bit version of socketcall system call linux)
packet sniffer in python (interface has set promiscous mode):
import socket import os # host listen host = '192.168.1.114' def sniffing(host, win, socket_prot): while 1: sniffer = socket.socket(socket.af_inet, socket.sock_raw, socket_prot) sniffer.bind((host, 0)) # include ip headers in captured packets sniffer.setsockopt(socket.ipproto_ip, socket.ip_hdrincl, 1) if win == 1: sniffer.ioctl(socket.sio_rcvall, socket_rcvall_on) # read in single packet print sniffer.recvfrom(65565) def main(host): if os.name == 'nt': sniffing(host, 1, socket.ipproto_ip) else: sniffing(host, 0, socket.ipproto_icmp) if __name__ == '__main__': main(host)
copied http://bt3gl.github.io/black-hat-python-building-a-udp-scanner.html
Comments
Post a Comment