
Masscanned (الاسم مستوحى بالطبع من Masscan) هو مستجيب للشبكة. والغرض منه هو تقديم إجابات عامة لأكبر عدد ممكن من البروتوكولات، مع أقل عدد ممكن من الافتراضات حول نوايا العميل.
دعهم يتحدثون أولاً.
تمامًا مثل Masscan، يطبق Masscanned مكدس شبكة أرض المستخدم الخاص به، على غرار Honeyd. وهو مصمم للتفاعل مع الماسحات الضوئية والروبوتات الانتهازية إلى أقصى حد ممكن، ودعم أكبر عدد ممكن من البروتوكولات.
على سبيل المثال، عندما يتلقى حزم الشبكة:
ARP who is-at مع ARP is-at (لعناوين IP الخاصة به)،ICMP Echo Request مع ICMP Echo Reply ،TCP SYN (أي منفذ) مع TCP SYN/ACK على أي منفذ،HTTP (أي فعل) عبر TCP/UDP (أي منفذ) باستخدام صفحة ويب HTTP 401 . 
يدعم Masscanned حاليًا معظم البروتوكولات الشائعة في الطبقات 2-3-4، بالإضافة إلى عدد قليل من بروتوكولات التطبيقات.
$ cargo build
# ip netns add masscanned
# ip link add vethmasscanned type veth peer veth netns masscanned
# ip link set vethmasscanned up
# ip -n masscanned link set veth up
# ip addr add dev vethmasscanned 192.168.0.0/31
# ip netns exec masscanned ./target/debug/masscanned --iface veth -v[vv]
# arping 192.168.0.1
# ping 192.168.0.1
# nc -n -v 192.168.0.1 80
# nc -n -v -u 192.168.0.1 80
...
# apt install docker.io
$ cd masscanned/docker && docker build -t masscanned:test .
$ docker run --cap-add=NET_ADMIN masscanned:test
# arping 172.17.0.2
# ping 172.17.0.2
# nc -n -v 172.17.0.2 80
# nc -n -v -u 172.17.0.2 80
...
الاستخدام الجيد لـ Masscanned هو نشره على VPS باستخدام عنوان IP عام واحد أو أكثر.
لاستخدام النتائج، فإن أفضل طريقة هي التقاط كل حركة مرور الشبكة على الواجهة التي يتم الاستماع إليها/الاستجابة لها. يمكن بعد ذلك تحليل ملفات pcaps باستخدام zeek ويمكن عادةً دفع ملفات الإخراج في مثيل IVRE .
ستتوفر وثائق حول كيفية نشر مثيل المسح الجماعي على VPS (راجع الإصدار رقم 2).
Network answering machine for various network protocols (L2-L3-L4 + applications)
Usage: masscanned [OPTIONS] --iface <iface>
Options:
-i, --iface <iface>
the interface to use for receiving/sending packets
-m, --mac-addr <mac>
MAC address to use in the response packets
--self-ip-file <selfipfile>
File with the list of IP addresses handled by masscanned
--self-ip-list <selfiplist>
Inline list of IP addresses handled by masscanned, comma-separated
--remote-ip-deny-file <remoteipdenyfile>
File with the list of IP addresses from which masscanned will ignore packets
--remote-ip-deny-list <remoteipdenylist>
Inline list of IP addresses from which masscanned will ignore packets
-v...
Increase message verbosity
-q, --quiet
Quiet mode: do not output anything on stdout
--format <format>
Format in which to output logs [default: console] [possible values: console, logfmt]
-h, --help
Print help information
-V, --version
Print version information
إجابات masscanned لطلبات ARP ، للطلبات التي تستهدف عنوان IPv4 الذي تتم معالجته بواسطة masscanned ( أي عنوان موجود في ملف عنوان IP المتوفر مع الخيار -f ).
تحتوي الإجابة على أول عناوين MAC المحتملة التالية:
MAC المحدد بـ -a في سطر الأوامر إن وجد،MAC الخاص بالواجهة المحددة بـ -i في سطر الأوامر إن وجد،MAC الافتراضي masscanned ، على سبيل المثال ، c0:ff:ee:c0:ff:ee . الإجابات masscanned على إطارات Ethernet ، فقط إذا تم استيفاء المتطلبات التالية:
يجب معالجة عنوان الوجهة للإطار بواسطة masscanned ، مما يعني:
MAC الخاص masscanned ،MAC ff:ff:ff:ff:ff:ffMAC متعدد البث يتوافق مع أحد عناوين IPv4 التي تتم معالجتها بواسطة masscanned (RFC 1112)،MAC متعدد البث يتوافق مع أحد عناوين IPv6 التي تتم معالجتها بواسطة masscanned ؛ حقل EtherType هو أحد ARP أو IPv4 أو IPv6 .
ملاحظة: حتى بالنسبة لعنوان IP غير متعدد البث، سوف يستجيب masscanned لإطارات L2 الموجهة إلى عنوان MAC متعدد البث المطابق. على سبيل المثال، إذا كان masscanned يعالج 10.11.12.13 ، فسوف يجيب على الإطارات الموجهة إلى 01:00:5e:0b:0c:0d .
إجابات masscanned على حزم IPv4 و IPv6 ، فقط في حالة:
IP في ملف ( على سبيل المثال ، تم تحديد خيار no -f أو أن الملف فارغ)،أو
masscanned .من المتطلبات الإضافية أن يكون بروتوكول الطبقة التالية مدعومًا - انظر أدناه.
يتم دعم بروتوكولات L3+/4 التالية لحزمة IPv4 :
ICMPv4UDPTCPإذا لم يكن بروتوكول الطبقة التالية واحدًا منها، فسيتم إسقاط الحزمة.
يتم دعم بروتوكولات L3+/4 التالية لحزمة IPv6 :
ICMPv6UDPTCPإذا لم يكن بروتوكول الطبقة التالية واحدًا منها، فسيتم إسقاط الحزمة.
الإجابات masscanned لحزم ICMPv4 إذا وفقط إذا:
ICMP للحزمة الواردة هو EchoRequest ( 8 )،ICMP للحزمة الواردة هو 0 . إذا تم استيفاء هذه الشروط، masscanned الإجابات باستخدام حزمة ICMP من النوع EchoReply ( 0 )، والرمز 0 ونفس الحمولة مثل الحزمة الواردة، كما هو محدد بواسطة RFC 792.
الإجابات masscanned لحزم ICMPv6 إذا وفقط إذا:
ICMP هو NeighborSol ( 135 ) و :masscannedmasscanned في هذه الحالة، يكون الجواب عبارة عن حزمة Neighbor Advertisement ( 136 ) تحتوي على عنوان MAC masscanned
أو
ICMP هو EchoRequest ( 128 ) في هذه الحالة، الجواب هو حزمة EchoReply ( 129 ).
إجابات masscanned على حزم TCP التالية:
PSH و ACK ، فسيقوم masscanned بالتحقق من ملف تعريف الارتباط SYNACK ، وإذا كانت الإجابات الصحيحة على الأقل ACK ، أو PSH-ACK إذا تم اكتشاف بروتوكول مدعوم (الطبقة 5/6/7)،ACK ، فسيتم تجاهلها،RST أو FIN-ACK ، فسيتم تجاهلها،SYN ، فسيحاول masscanned تقليد سلوك مكدس Linux القياسي - وهو:PSH و URG و CWR و ECE ، فسيتم تجاهل SYN ،CWR و ECE في وقت واحد، فسيتم تجاهل SYN ،masscanned باستخدام حزمة SYN-ACK ، مع تعيين ملف تعريف الارتباط SYNACK في الرقم التسلسلي. إجابات masscanned على حزمة UDP إذا وفقط إذا تم التعامل مع بروتوكول الطبقة العليا وقدم إجابة.
إجابات masscanned على أي طلب HTTP (أي فعل صالح ) مع 401 Authorization Required . لاحظ أنه لن يتم الرد على طلبات HTTP التي تحتوي على فعل غير صالح.
مثال:
$ curl -X GET 10.11.10.129
<html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.14.2</center>
</body>
</html>
$ curl -X OPTIONS 10.11.10.129
<html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.14.2</center>
</body>
</html>
$ curl -X HEAD 10.11.10.129
Warning: Setting custom HTTP method to HEAD with -X/--request may not work the
Warning: way you want. Consider using -I/--head instead.
<html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.14.2</center>
</body>
</html>
$ curl -X XXX 10.11.10.129
[timeout]
مثال:
$ stun 10.11.10.129
STUN client version 0.97
Primary: Open
Return value is 0x000001
الإجابات masscanned لعميل SSH Client: Protocol مع Server: Protocol :
SSH-2.0-1rn
إجابات masscanned على حزم Negotiate Protocol Request حتى يتمكن العميل من إرسال NTLMSSP_NEGOTIATE ، والتي تجيب عليها masscanned مع التحدي.
مثال:
##$ smbclient -U user \\10.11.10.129\shared
Enter WORKGROUPuser's password:
إجابات masscanned لاستعلامات DNS للفئة IN والنوع A (في الوقت الحالي). تحتوي الإجابة التي تقدمها دائمًا على عنوان IP الذي تم إرسال الاستعلام إليه.
مثال:
$ host -t A masscan.ned 10.11.10.129
Using domain server:
Name: 10.11.10.129
Address: 10.11.10.129#53
Aliases:
masscan.ned has address 10.11.10.129
$ host -t A masscan.ned 10.11.10.130
Using domain server:
Name: 10.11.10.130
Address: 10.11.10.130#53
Aliases:
masscan.ned has address 10.11.10.130
$ host -t A masscan.ned 10.11.10.131
Using domain server:
Name: 10.11.10.131
Address: 10.11.10.131#53
Aliases:
masscan.ned has address 10.11.10.131
$ host -t A masscan.ned 10.11.10.132
Using domain server:
Name: 10.11.10.132
Address: 10.11.10.132#53
Aliases:
masscan.ned has address 10.11.10.132
$ cargo test
Compiling masscanned v0.2.0 (/zdata/workdir/masscanned)
Finished test [unoptimized + debuginfo] target(s) in 3.83s
Running unittests (target/debug/deps/masscanned-f9292f8600038978)
running 92 tests
test client::client_info::tests::test_client_info_eq ... ok
test layer_2::arp::tests::test_arp_reply ... ok
test layer_2::tests::test_eth_empty ... ok
test layer_2::tests::test_eth_reply ... ok
test layer_3::ipv4::tests::test_ipv4_reply ... ok
test layer_3::ipv4::tests::test_ipv4_empty ... ok
test layer_3::ipv6::tests::test_ipv6_empty ... ok
test layer_3::ipv6::tests::test_ipv6_reply ... ok
test layer_4::icmpv4::tests::test_icmpv4_reply ... ok
test layer_4::icmpv6::tests::test_icmpv6_reply ... ok
test layer_4::icmpv6::tests::test_nd_na_reply ... ok
test layer_4::tcp::tests::test_synack_cookie_ipv6 ... ok
test layer_4::tcp::tests::test_tcp_fin_ack_wrap ... ok
test proto::dns::cst::tests::class_parse ... ok
test layer_4::tcp::tests::test_tcp_fin_ack ... ok
test layer_4::tcp::tests::test_synack_cookie_ipv4 ... ok
test proto::dns::cst::tests::type_parse ... ok
test proto::dns::header::tests::parse_byte_by_byte ... ok
test proto::dns::header::tests::repl_id ... ok
test proto::dns::header::tests::repl_opcode ... ok
test proto::dns::header::tests::repl_ancount ... ok
test proto::dns::header::tests::repl_rd ... ok
test proto::dns::query::tests::parse_in_a_all ... ok
test proto::dns::header::tests::parse_all ... ok
test proto::dns::query::tests::repl ... ok
test proto::dns::query::tests::reply_in_a ... ok
test proto::dns::rr::tests::parse_all ... ok
test proto::dns::rr::tests::parse_byte_by_byte ... ok
test proto::dns::query::tests::parse_in_a_byte_by_byte ... ok
test proto::dns::tests::parse_qd_all ... ok
test proto::dns::tests::parse_qd_byte_by_byte ... ok
test proto::dns::rr::tests::build ... ok
test proto::dns::tests::parse_qd_rr_all ... ok
test proto::dns::tests::parse_qr_rr_byte_by_byte ... ok
test proto::dns::tests::parse_rr_byte_by_byte ... ok
test proto::dns::tests::parse_rr_all ... ok
test proto::dns::tests::reply_in_a ... ok
test proto::http::tests::test_http_request_line ... ok
test proto::http::tests::test_http_request_no_field ... ok
test proto::http::tests::test_http_request_field ... ok
test proto::http::tests::test_http_verb ... ok
test proto::rpc::tests::test_probe_nmap ... ok
test proto::rpc::tests::test_probe_nmap_split1 ... ok
test proto::rpc::tests::test_probe_portmap_v4_dump ... ok
test proto::rpc::tests::test_probe_nmap_split2 ... ok
test proto::rpc::tests::test_probe_nmap_udp ... ok
test proto::smb::tests::test_smb1_session_setup_request_parse ... ok
test proto::smb::tests::test_smb1_protocol_nego_parsing ... ok
test proto::smb::tests::test_smb1_protocol_nego_reply ... ok
test proto::smb::tests::test_smb1_session_setup_request_reply ... ok
test proto::smb::tests::test_smb2_protocol_nego_parsing ... ok
test proto::smb::tests::test_smb2_protocol_nego_reply ... ok
test proto::smb::tests::test_smb2_session_setup_request_reply ... ok
test proto::smb::tests::test_smb2_session_setup_request_parse ... ok
test proto::ssh::tests::ssh_1_banner_cr ... ok
test proto::ssh::tests::ssh_1_banner_crlf ... ok
test proto::ssh::tests::ssh_1_banner_lf ... ok
test proto::ssh::tests::ssh_1_banner_space ... ok
test proto::ssh::tests::ssh_2_banner_cr ... ok
test proto::ssh::tests::ssh_1_banner_parse ... ok
test proto::ssh::tests::ssh_2_banner_parse ... ok
test proto::ssh::tests::ssh_2_banner_lf ... ok
test proto::ssh::tests::ssh_2_banner_crlf ... ok
test proto::stun::tests::test_change_request_port_overflow ... ok
test proto::stun::tests::test_proto_stun_ipv4 ... ok
test proto::stun::tests::test_change_request_port ... ok
test proto::ssh::tests::ssh_2_banner_space ... ok
test proto::stun::tests::test_proto_stun_ipv6 ... ok
test proto::tcb::tests::test_proto_tcb_proto_state_http ... ok
test proto::tests::dispatch_dns ... ok
test proto::tcb::tests::test_proto_tcb_proto_state_rpc ... ok
test proto::tcb::tests::test_proto_tcb_proto_id ... ok
test proto::tests::test_proto_dispatch_http ... ok
test proto::tests::test_proto_dispatch_ssh ... ok
test proto::tests::test_proto_dispatch_ghost ... ok
test proto::tests::test_proto_dispatch_stun ... ok
test smack::smack::tests::test_anchor_end ... ok
test smack::smack::tests::test_multiple_matches_wildcard ... ok
test smack::smack::tests::test_multiple_matches ... ok
test smack::smack::tests::test_anchor_begin ... ok
test smack::smack::tests::test_http_banner ... ok
test synackcookie::tests::test_clientinfo ... ok
test synackcookie::tests::test_ip4 ... ok
test synackcookie::tests::test_ip4_dst ... ok
test synackcookie::tests::test_ip4_src ... ok
test synackcookie::tests::test_ip6 ... ok
test synackcookie::tests::test_key ... ok
test synackcookie::tests::test_tcp_dst ... ok
test synackcookie::tests::test_tcp_src ... ok
test smack::smack::tests::test_wildcard ... ok
test smack::smack::tests::test_proto ... ok
test smack::smack::tests::test_pattern ... ok
test result: ok. 92 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.41s
# ./test/test_masscanned.py
INFO test_arp_req......................................OK
INFO test_arp_req_other_ip.............................OK
INFO test_ipv4_udp_dns_in_a............................OK
INFO test_ipv4_udp_dns_in_a_multiple_queries...........OK
INFO test_ipv4_tcp_ghost...............................OK
INFO test_ipv4_tcp_http................................OK
INFO test_ipv4_tcp_http_segmented......................OK
INFO test_ipv4_tcp_http_incomplete.....................OK
INFO test_ipv6_tcp_http................................OK
INFO test_ipv4_udp_http................................OK
INFO test_ipv6_udp_http................................OK
INFO test_ipv4_tcp_http_ko.............................OK
INFO test_ipv4_udp_http_ko.............................OK
INFO test_ipv6_tcp_http_ko.............................OK
INFO test_ipv6_udp_http_ko.............................OK
INFO test_icmpv4_echo_req..............................OK
INFO test_icmpv6_neighbor_solicitation.................OK
INFO test_icmpv6_neighbor_solicitation_other_ip........OK
INFO test_icmpv6_echo_req..............................OK
INFO test_ipv4_req.....................................OK
INFO test_eth_req_other_mac............................OK
INFO test_ipv4_req_other_ip............................OK
INFO test_rpc_nmap.....................................OK
INFO test_rpcinfo......................................OK
INFO test_smb1_network_req.............................OK
INFO test_smb2_network_req.............................OK
INFO test_ipv4_tcp_ssh.................................OK
INFO test_ipv4_udp_ssh.................................OK
INFO test_ipv6_tcp_ssh.................................OK
INFO test_ipv6_udp_ssh.................................OK
INFO test_ipv4_udp_stun................................OK
INFO test_ipv6_udp_stun................................OK
INFO test_ipv4_udp_stun_change_port....................OK
INFO test_ipv6_udp_stun_change_port....................OK
INFO test_ipv4_tcp_empty...............................OK
INFO test_ipv6_tcp_empty...............................OK
INFO test_tcp_syn......................................OK
INFO test_ipv4_tcp_psh_ack.............................OK
INFO test_ipv6_tcp_psh_ack.............................OK
INFO test_ipv4_udp_empty...............................OK
INFO test_ipv6_udp_empty...............................OK
INFO Ran 41 tests with 0 errors
يمكنك أيضًا اختيار الاختبارات التي سيتم تشغيلها باستخدام متغير البيئة TESTS
TESTS=smb ./test/test_masscanned.py
INFO test_smb1_network_req.............................OK
INFO test_smb2_network_req.............................OK
INFO Ran 2 tests with 0 errors
أفعال :
initrecvsenddrop $ts arp $verb $operation $client_mac $client_ip $masscanned_mac $masscanned_ip
$ts eth $verb $ethertype $client_mac $masscanned_mac