NetworkSniffer (version 0.0.1) | index NetworkSniffer.py |
This module sniffs network communications without any requirements
~# python3.11 NetworkSniffer.py -c
0000 00 00 00 45 56 ab 00 00 00 ba 65 54 08 00 45 00 RT..5...'..g..E.
0010 00 54 42 e4 40 00 40 01 db a6 0a 00 02 0f 08 08 .TB.@.@.........
0020 08 08 08 00 71 3c 5a 9c 00 01 1f 63 e5 63 00 00 ....q<Z....c.c..
0030 00 00 68 8c 00 00 00 00 00 00 10 11 12 13 14 15 ..h.............
0040 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 .......... !"#$%
0050 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 &'()*+,-./012345
0060 36 37 67
~# python3.11 NetworkSniffer.py -x -s -c
[Internet Protocol version 4 (IPv4) ICMP][64] 10.0.2.15(00:00:00:ba:65:54):0 -> 8.8.8.8(00:00:00:45:56:ab):0
~# python3.11 NetworkSniffer.py -x -X -c
0000 47 45 54 20 2f 20 48 54 54 50 2f 31 2e 31 0d 0a GET / HTTP/1.1..
0010 48 6f 73 74 3a 20 65 78 61 6d 70 6c 65 2e 63 6f Host: example.co
0020 6d 0d 0a 55 73 65 72 2d 41 67 65 6e 74 3a 20 63 m..User-Agent: c
0030 75 72 6c 2f 37 2e 38 37 2e 30 0d 0a 41 63 63 65 url/7.87.0..Acce
0040 70 74 3a 20 2a 2f 2a 0d 0a 0d 0a pt: */*....
~# python3.11 NetworkSniffer.py -x -r -c
<raw data>
GET / HTTP/1.1
Host: example.com
User-Agent: python/5.72
Accept: */*
<raw data>
~# python3.11 NetworkSniffer.py -x -R -c
GET / HTTP/1.1
Host: example.com
User-Agent: Python5.72
Accept: */*
HTTP/1.1 200 OK
Age: 278171
Cache-Control: max-age=604800
Content-Type: text/html; charset=UTF-8
Date: Thu, 22 Jun 2016 07:18:26 GMT
Etag: "3147526947+ident"
Expires: Thu, 22 Jun 2016 07:18:26 GMT
Last-Modified: Thu, 22 Jun 2016 07:18:26 GMT
Server: ECS (dcb/7F83)
Vary: Accept-Encoding
X-Cache: HIT
Content-Length: 1256
<HTTP body content>
~# python3.11 NetworkSniffer.py -x -s -t -c
[Internet Protocol version 4 (IPv4) TCP Flags: S][0] 10.0.2.15(00:00:00:ba:65:54):38974 -> 93.184.216.34(00:00:00:45:56:ab):80
~# python3.11 NetworkSniffer.py -x -s -u -c
[Internet Protocol version 4 (IPv4) UDP][282] 192.168.56.101(08:00:27:c5:14:72):68 -> 192.168.56.100(08:00:27:e6:dc:08):67
~# python3.11 NetworkSniffer.py -x -s -4 -c
[Internet Protocol version 4 (IPv4) ICMP][64] 10.0.2.15(00:00:00:ba:65:54):0 -> 8.8.8.8(00:00:00:45:56:ab):0
~# python3.11 NetworkSniffer.py -x -s -6 -c
[Internet Protocol Version 6 (IPv6) IPv6-ICMP][64] fe80:0000:0000:0000:2541:637:8596:fedc(00:00:00:00:00:00):0 -> fe80:0000:0000:0000:2541:637:8596:fedc(00:00:00:00:00:00):0
~# python3.11 NetworkSniffer.py -x -s -c -n '192.168.56.0/24'
[Internet Protocol version 4 (IPv4) TCP Flags: S][0] 192.168.56.1(0a:00:27:00:00:0f):65385 -> 192.168.56.101(08:00:27:c5:14:72):8000
~# python3.11 NetworkSniffer.py -x -s -c -n '10.0.0.0/8' '192.168.56.0/24'
[Internet Protocol version 4 (IPv4) ICMP][64] 10.0.2.15(00:00:00:ba:65:54):0 -> 8.8.8.8(00:00:00:45:56:ab):0
~# python3.11 NetworkSniffer.py -x -s -c -p 80 53
[Internet Protocol version 4 (IPv4) UDP Flags: F][36] 10.0.2.15(00:00:00:ba:65:54):53678 -> 172.16.0.1(00:00:00:45:56:ab):53
~# python3.11 NetworkSniffer.py -x -s -c -m '00:00:00:00:00:00'
[Internet Protocol Version 6 (IPv6) IPv6-ICMP][64] fe80:0000:0000:0000:2541:637:8596:fedc(00:00:00:00:00:00):0 -> fe80:0000:0000:0000:2541:637:8596:fedc(00:00:00:00:00:00):0
~# python3.11 NetworkSniffer.py -x -s -c -m '00:00:00:00:00:00' '00:00:00:ba:65:54'
[Internet Protocol version 4 (IPv4) ICMP][64] 10.0.2.15(00:00:00:ba:65:54):0 -> 8.8.8.8(00:00:00:45:56:ab):0
~# python3.11 NetworkSniffer.py -x -s -c -i '192.168.56.101'
[Internet Protocol version 4 (IPv4) UDP][282] 192.168.56.101(08:00:27:c5:14:72):68 -> 192.168.56.100(08:00:27:e6:dc:08):67
~# python3.11 NetworkSniffer.py -x -s -c -i '192.168.56.101' '10.0.2.15'
[Internet Protocol version 4 (IPv4) ICMP][64] 10.0.2.15(00:00:00:ba:65:54):0 -> 8.8.8.8(00:00:00:45:56:ab):0
~# python3.11 NetworkSniffer.py -c -l 20
0000 00 00 00 45 56 ab 00 00 00 ba 65 54 08 00 45 00 00 54 9f 1a RT..5...'..g..E..T..
0014 40 00 40 01 7f 70 0a 00 02 0f 08 08 08 08 08 00 f3 11 ff 34 @.@..p.............4
0028 00 01 5a 65 e5 63 00 00 00 00 03 1c 04 00 00 00 00 00 10 11 ..Ze.c..............
003c 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 .............. !"#$%
0050 26 27 28 29 2a 2b 2c 2d 2e 2f 30 31 32 33 34 35 36 37 &'()*+,-./01234567
~# python3.11 NetworkSniffer.py -x -s -f 'test.txt'
~#
>>> sniffer = Sniffer(
... [('172.17.0.1', 0), ('192.168.56.1', 0)],
... [('fe80:0000:0000:0000:1425:3647:5869:abcd', 0, 0, 18)],
... (summary, hexadecimal),
... )
>>> sniffer.sniff()
<sniffed data>
>>>
>>> SnifferFilters = new_class(
... "SnifferFilters",
... (TcpFilter, Sniffer),
... {},
... )
>>> sniffer = SnifferFilters(
... [('172.17.0.1', 0), ('192.168.56.1', 0)],
... [('fe80:0000:0000:0000:1425:3647:5869:abcd', 0, 0, 18)],
... (summary, hexadecimal),
... tcp_filter=True,
... )
>>> sniffer.sniff()
<sniffed data>
>>>
>>> ipv4_addresses, ipv6_addresses = get_addresses()
>>> sniffer = Sniffer(
... ipv4_addresses,
... ipv6_addresses,
... (raw,),
... )
>>> sniffer.sniff()
<sniffed data>
>>>
Classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Functions | ||
|
Data | ||
__all__ = ['Sniffer', 'MacFilter', 'IpFilter', 'PortsFilter', 'TcpFilter', 'UdpFilter', 'IPv4Filter', 'IPv6Filter', 'NetworksFilter', 'hexadecimal', 'hexadecimal_data', 'raw', 'raw_data', 'summary', 'get_addresses'] __annotations__ = {'Ethernet': <class 'type'>, 'IPv4': <class 'type'>, 'IPv6': <class 'type'>, 'IpFlags': <class 'type'>, 'TCP': <class 'type'>, 'TcpFlags': <class 'type'>, 'TrafficClass': <class 'type'>, 'UDP': <class 'type'>, 'Unknow': <class 'type'>, 'ethernet_types': typing.Dict[int, str], ...} __author_email__ = 'mauricelambert434@gmail.com' __copyright__ = '\nNetworkSniffer Copyright (C) 2023 Maurice Lam...ome to redistribute it\nunder certain conditions.\n' __description__ = 'This module sniffs network communications without any requirements' __license__ = 'GPL-3.0 License' __maintainer__ = 'Maurice Lambert' __maintainer_email__ = 'mauricelambert434@gmail.com' __url__ = 'https://github.com/mauricelambert/NetworkSniffer' |
Author | ||
Maurice Lambert |