phronesis-nse 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nmap_select.py +801 -0
- nse-library/EXCLUDED.md +4 -0
- nse-library/LICENSES/hackertarget-LICENSE +340 -0
- nse-library/LICENSES/nmap-NPSL.txt +583 -0
- nse-library/LICENSES/vulners-LICENSE +583 -0
- nse-library/README.md +15 -0
- nse-library/THIRD_PARTY_NOTICES.md +20 -0
- nse-library/catalog.jsonl +649 -0
- nse-library/community/cldrn/scripts/dns-cname-dangling.nse +504 -0
- nse-library/community/cldrn/scripts/dns-openresolvers-check.nse +84 -0
- nse-library/community/cldrn/scripts/google-people-enum.nse +213 -0
- nse-library/community/cldrn/scripts/hostmap-ip2hosts.nse +131 -0
- nse-library/community/cldrn/scripts/hostmap.nse +207 -0
- nse-library/community/cldrn/scripts/http-email-harvest.nse +59 -0
- nse-library/community/cldrn/scripts/http-httpoxy.nse +151 -0
- nse-library/community/cldrn/scripts/http-iis-shortname-dos.nse +53 -0
- nse-library/community/cldrn/scripts/http-phpselfxss-scan.nse +81 -0
- nse-library/community/cldrn/scripts/http-shellshock-spider.nse +74 -0
- nse-library/community/cldrn/scripts/http-sitemap-dump.nse +335 -0
- nse-library/community/cldrn/scripts/http-sitemap.nse +42 -0
- nse-library/community/cldrn/scripts/http-tomcat-brute.nse +116 -0
- nse-library/community/cldrn/scripts/http-trendnet-tvip110w.nse +39 -0
- nse-library/community/cldrn/scripts/http-wp-enum.nse +137 -0
- nse-library/community/cldrn/scripts/huawei5xx-udp-info.nse +103 -0
- nse-library/community/cldrn/scripts/nse-script-template.nse +21 -0
- nse-library/community/cldrn/scripts/smtp-dovecot-exim-exec.nse +110 -0
- nse-library/community/cldrn/scripts/vulscan.nse +538 -0
- nse-library/community/hackertarget/scripts/hostmap-hackertarget.nse +83 -0
- nse-library/community/hackertarget/scripts/http-wordpress-info.nse +227 -0
- nse-library/community/hackertarget/scripts/http-wordpress-plugins.nse +197 -0
- nse-library/community/hackertarget/scripts/http-wordpress-themes.nse +192 -0
- nse-library/community/personal/scripts/exploit-xunlei-rce.nse +6 -0
- nse-library/community/personal/scripts/my-dokuwiki-audit.nse +17 -0
- nse-library/community/psc4re/scripts/CVE-2021-21972.nse +89 -0
- nse-library/community/psc4re/scripts/cve-2020-0796.nse +101 -0
- nse-library/community/psc4re/scripts/cve-2020-1350.nse +89 -0
- nse-library/community/psc4re/scripts/http-custom-title.nse +99 -0
- nse-library/community/psc4re/scripts/proxyshell.nse +41 -0
- nse-library/manifest.json +4386 -0
- nse-library/nselib/afp.lua +2219 -0
- nse-library/nselib/ajp.lua +546 -0
- nse-library/nselib/amqp.lua +333 -0
- nse-library/nselib/anyconnect.lua +136 -0
- nse-library/nselib/asn1.lua +527 -0
- nse-library/nselib/base32.lua +245 -0
- nse-library/nselib/base64.lua +203 -0
- nse-library/nselib/bin.lua +367 -0
- nse-library/nselib/bitcoin.lua +628 -0
- nse-library/nselib/bits.lua +79 -0
- nse-library/nselib/bittorrent.lua +1053 -0
- nse-library/nselib/bjnp.lua +363 -0
- nse-library/nselib/brute.lua +1551 -0
- nse-library/nselib/cassandra.lua +190 -0
- nse-library/nselib/citrixxml.lua +528 -0
- nse-library/nselib/coap.lua +2675 -0
- nse-library/nselib/comm.lua +305 -0
- nse-library/nselib/creds.lua +541 -0
- nse-library/nselib/cvs.lua +96 -0
- nse-library/nselib/data/dns-srv-names +74 -0
- nse-library/nselib/data/drupal-modules.lst +17447 -0
- nse-library/nselib/data/drupal-themes.lst +1333 -0
- nse-library/nselib/data/enterprise_numbers.txt +59209 -0
- nse-library/nselib/data/favicon-db +133 -0
- nse-library/nselib/data/http-default-accounts-fingerprints.lua +1738 -0
- nse-library/nselib/data/http-devframework-fingerprints.lua +440 -0
- nse-library/nselib/data/http-fingerprints.lua +12859 -0
- nse-library/nselib/data/http-folders.txt +910 -0
- nse-library/nselib/data/http-sql-errors.lst +112 -0
- nse-library/nselib/data/http-web-files-extensions.lst +214 -0
- nse-library/nselib/data/idnaMappings.lua +13307 -0
- nse-library/nselib/data/ike-fingerprints.lua +2473 -0
- nse-library/nselib/data/jdwp-class/JDWPExecCmd.class +0 -0
- nse-library/nselib/data/jdwp-class/JDWPExecCmd.java +31 -0
- nse-library/nselib/data/jdwp-class/JDWPSystemInfo.class +0 -0
- nse-library/nselib/data/jdwp-class/JDWPSystemInfo.java +41 -0
- nse-library/nselib/data/jdwp-class/README.txt +26 -0
- nse-library/nselib/data/mgroupnames.db +485 -0
- nse-library/nselib/data/mysql-cis.audit +228 -0
- nse-library/nselib/data/oracle-default-accounts.lst +687 -0
- nse-library/nselib/data/oracle-sids +735 -0
- nse-library/nselib/data/packetdecoders.lua +951 -0
- nse-library/nselib/data/passwords.lst +5007 -0
- nse-library/nselib/data/pixel.gif +0 -0
- nse-library/nselib/data/psexec/README +15 -0
- nse-library/nselib/data/psexec/backdoor.lua +25 -0
- nse-library/nselib/data/psexec/default.lua +144 -0
- nse-library/nselib/data/psexec/drives.lua +47 -0
- nse-library/nselib/data/psexec/examples.lua +67 -0
- nse-library/nselib/data/psexec/experimental.lua +24 -0
- nse-library/nselib/data/psexec/network.lua +111 -0
- nse-library/nselib/data/psexec/nmap_service.c +380 -0
- nse-library/nselib/data/psexec/nmap_service.vcproj +194 -0
- nse-library/nselib/data/psexec/pwdump.lua +50 -0
- nse-library/nselib/data/publickeydb +3 -0
- nse-library/nselib/data/rtsp-urls.txt +178 -0
- nse-library/nselib/data/snmpcommunities.lst +27 -0
- nse-library/nselib/data/ssl-fingerprints +2077 -0
- nse-library/nselib/data/targets-ipv6-wordlist +2651 -0
- nse-library/nselib/data/tftp-fingerprints.lua +146 -0
- nse-library/nselib/data/tftplist.txt +255 -0
- nse-library/nselib/data/usernames.lst +10 -0
- nse-library/nselib/data/vhosts-default.lst +128 -0
- nse-library/nselib/data/vhosts-full.lst +498 -0
- nse-library/nselib/data/wp-plugins.lst +80377 -0
- nse-library/nselib/data/wp-themes.lst +14247 -0
- nse-library/nselib/datafiles.lua +342 -0
- nse-library/nselib/datetime.lua +252 -0
- nse-library/nselib/dhcp.lua +649 -0
- nse-library/nselib/dhcp6.lua +661 -0
- nse-library/nselib/dicom.lua +1558 -0
- nse-library/nselib/dns.lua +1634 -0
- nse-library/nselib/dnsbl.lua +624 -0
- nse-library/nselib/dnssd.lua +402 -0
- nse-library/nselib/drda.lua +778 -0
- nse-library/nselib/eap.lua +289 -0
- nse-library/nselib/eigrp.lua +355 -0
- nse-library/nselib/formulas.lua +220 -0
- nse-library/nselib/ftp.lua +284 -0
- nse-library/nselib/geoip.lua +138 -0
- nse-library/nselib/giop.lua +633 -0
- nse-library/nselib/gps.lua +126 -0
- nse-library/nselib/http.lua +3326 -0
- nse-library/nselib/httpspider.lua +1071 -0
- nse-library/nselib/iax2.lua +340 -0
- nse-library/nselib/idna.lua +565 -0
- nse-library/nselib/iec61850mms.lua +1187 -0
- nse-library/nselib/ike.lua +550 -0
- nse-library/nselib/imap.lua +280 -0
- nse-library/nselib/informix.lua +1333 -0
- nse-library/nselib/ipOps.lua +891 -0
- nse-library/nselib/ipmi.lua +306 -0
- nse-library/nselib/ipp.lua +411 -0
- nse-library/nselib/irc.lua +37 -0
- nse-library/nselib/iscsi.lua +729 -0
- nse-library/nselib/isns.lua +556 -0
- nse-library/nselib/jdwp.lua +1079 -0
- nse-library/nselib/json.lua +443 -0
- nse-library/nselib/knx.lua +87 -0
- nse-library/nselib/ldap.lua +917 -0
- nse-library/nselib/lfs.luadoc +48 -0
- nse-library/nselib/libssh2-utility.lua +285 -0
- nse-library/nselib/libssh2.luadoc +169 -0
- nse-library/nselib/listop.lua +184 -0
- nse-library/nselib/lpeg-utility.lua +170 -0
- nse-library/nselib/lpeg.luadoc +10 -0
- nse-library/nselib/ls.lua +368 -0
- nse-library/nselib/match.lua +62 -0
- nse-library/nselib/membase.lua +337 -0
- nse-library/nselib/mobileme.lua +242 -0
- nse-library/nselib/mongodb.lua +973 -0
- nse-library/nselib/mqtt.lua +1016 -0
- nse-library/nselib/msrpc.lua +5309 -0
- nse-library/nselib/msrpcperformance.lua +620 -0
- nse-library/nselib/msrpctypes.lua +4654 -0
- nse-library/nselib/mssql.lua +3491 -0
- nse-library/nselib/multicast.lua +178 -0
- nse-library/nselib/mysql.lua +570 -0
- nse-library/nselib/natpmp.lua +222 -0
- nse-library/nselib/nbd.lua +596 -0
- nse-library/nselib/ncp.lua +1116 -0
- nse-library/nselib/ndmp.lua +423 -0
- nse-library/nselib/netbios.lua +489 -0
- nse-library/nselib/nmap.luadoc +846 -0
- nse-library/nselib/nrpc.lua +164 -0
- nse-library/nselib/nsedebug.lua +131 -0
- nse-library/nselib/omp2.lua +178 -0
- nse-library/nselib/oops.lua +131 -0
- nse-library/nselib/openssl.luadoc +212 -0
- nse-library/nselib/ospf.lua +535 -0
- nse-library/nselib/outlib.lua +79 -0
- nse-library/nselib/packet.lua +1151 -0
- nse-library/nselib/pgsql.lua +620 -0
- nse-library/nselib/pop3.lua +235 -0
- nse-library/nselib/pppoe.lua +1005 -0
- nse-library/nselib/proxy.lua +314 -0
- nse-library/nselib/punycode.lua +473 -0
- nse-library/nselib/rand.lua +94 -0
- nse-library/nselib/rdp.lua +454 -0
- nse-library/nselib/re.lua +321 -0
- nse-library/nselib/redis.lua +217 -0
- nse-library/nselib/rmi.lua +1552 -0
- nse-library/nselib/rpc.lua +3474 -0
- nse-library/nselib/rpcap.lua +435 -0
- nse-library/nselib/rsync.lua +171 -0
- nse-library/nselib/rtsp.lua +291 -0
- nse-library/nselib/sasl.lua +510 -0
- nse-library/nselib/shortport.lua +423 -0
- nse-library/nselib/sip.lua +894 -0
- nse-library/nselib/slaxml.lua +449 -0
- nse-library/nselib/smb.lua +4461 -0
- nse-library/nselib/smb2.lua +393 -0
- nse-library/nselib/smbauth.lua +988 -0
- nse-library/nselib/smtp.lua +655 -0
- nse-library/nselib/snmp.lua +589 -0
- nse-library/nselib/socks.lua +283 -0
- nse-library/nselib/srvloc.lua +345 -0
- nse-library/nselib/ssh1.lua +275 -0
- nse-library/nselib/ssh2.lua +403 -0
- nse-library/nselib/sslcert.lua +1099 -0
- nse-library/nselib/sslv2.lua +366 -0
- nse-library/nselib/stdnse.lua +1100 -0
- nse-library/nselib/strbuf.lua +141 -0
- nse-library/nselib/strict.lua +88 -0
- nse-library/nselib/stringaux.lua +139 -0
- nse-library/nselib/stun.lua +388 -0
- nse-library/nselib/tab.lua +129 -0
- nse-library/nselib/tableaux.lua +90 -0
- nse-library/nselib/target.lua +115 -0
- nse-library/nselib/tftp.lua +347 -0
- nse-library/nselib/tls.lua +2073 -0
- nse-library/nselib/tn3270.lua +1406 -0
- nse-library/nselib/tns.lua +1798 -0
- nse-library/nselib/unicode.lua +469 -0
- nse-library/nselib/unittest.lua +524 -0
- nse-library/nselib/unpwdb.lua +338 -0
- nse-library/nselib/upnp.lua +397 -0
- nse-library/nselib/url.lua +550 -0
- nse-library/nselib/versant.lua +284 -0
- nse-library/nselib/vnc.lua +828 -0
- nse-library/nselib/vulns.lua +2317 -0
- nse-library/nselib/vuzedht.lua +548 -0
- nse-library/nselib/wsdd.lua +382 -0
- nse-library/nselib/xdmcp.lua +407 -0
- nse-library/nselib/xmpp.lua +456 -0
- nse-library/nselib/zlib.luadoc +112 -0
- nse-library/script.db +620 -0
- nse-library/scripts/acarsd-info.nse +115 -0
- nse-library/scripts/address-info.nse +299 -0
- nse-library/scripts/afp-brute.nse +111 -0
- nse-library/scripts/afp-ls.nse +187 -0
- nse-library/scripts/afp-path-vuln.nse +220 -0
- nse-library/scripts/afp-serverinfo.nse +175 -0
- nse-library/scripts/afp-showmount.nse +101 -0
- nse-library/scripts/ajp-auth.nse +72 -0
- nse-library/scripts/ajp-brute.nse +113 -0
- nse-library/scripts/ajp-headers.nse +46 -0
- nse-library/scripts/ajp-methods.nse +81 -0
- nse-library/scripts/ajp-request.nse +103 -0
- nse-library/scripts/allseeingeye-info.nse +219 -0
- nse-library/scripts/amqp-info.nse +60 -0
- nse-library/scripts/asn-query.nse +466 -0
- nse-library/scripts/auth-owners.nse +80 -0
- nse-library/scripts/auth-spoof.nse +37 -0
- nse-library/scripts/backorifice-brute.nse +291 -0
- nse-library/scripts/backorifice-info.nse +325 -0
- nse-library/scripts/bacnet-info.nse +1569 -0
- nse-library/scripts/banner.nse +198 -0
- nse-library/scripts/bitcoin-getaddr.nse +76 -0
- nse-library/scripts/bitcoin-info.nse +75 -0
- nse-library/scripts/bitcoinrpc-info.nse +165 -0
- nse-library/scripts/bittorrent-discovery.nse +139 -0
- nse-library/scripts/bjnp-discover.nse +50 -0
- nse-library/scripts/broadcast-ataoe-discover.nse +167 -0
- nse-library/scripts/broadcast-avahi-dos.nse +108 -0
- nse-library/scripts/broadcast-bjnp-discover.nse +174 -0
- nse-library/scripts/broadcast-db2-discover.nse +86 -0
- nse-library/scripts/broadcast-dhcp-discover.nse +285 -0
- nse-library/scripts/broadcast-dhcp6-discover.nse +102 -0
- nse-library/scripts/broadcast-dns-service-discovery.nse +55 -0
- nse-library/scripts/broadcast-dropbox-listener.nse +140 -0
- nse-library/scripts/broadcast-eigrp-discovery.nse +330 -0
- nse-library/scripts/broadcast-hid-discoveryd.nse +100 -0
- nse-library/scripts/broadcast-igmp-discovery.nse +397 -0
- nse-library/scripts/broadcast-jenkins-discover.nse +94 -0
- nse-library/scripts/broadcast-listener.nse +259 -0
- nse-library/scripts/broadcast-ms-sql-discover.nse +114 -0
- nse-library/scripts/broadcast-netbios-master-browser.nse +67 -0
- nse-library/scripts/broadcast-networker-discover.nse +104 -0
- nse-library/scripts/broadcast-novell-locate.nse +78 -0
- nse-library/scripts/broadcast-ospf2-discover.nse +422 -0
- nse-library/scripts/broadcast-pc-anywhere.nse +72 -0
- nse-library/scripts/broadcast-pc-duo.nse +132 -0
- nse-library/scripts/broadcast-pim-discovery.nse +197 -0
- nse-library/scripts/broadcast-ping.nse +274 -0
- nse-library/scripts/broadcast-pppoe-discover.nse +103 -0
- nse-library/scripts/broadcast-rip-discover.nse +181 -0
- nse-library/scripts/broadcast-ripng-discover.nse +222 -0
- nse-library/scripts/broadcast-sonicwall-discover.nse +131 -0
- nse-library/scripts/broadcast-sybase-asa-discover.nse +188 -0
- nse-library/scripts/broadcast-tellstick-discover.nse +69 -0
- nse-library/scripts/broadcast-upnp-info.nse +51 -0
- nse-library/scripts/broadcast-versant-locate.nse +41 -0
- nse-library/scripts/broadcast-wake-on-lan.nse +68 -0
- nse-library/scripts/broadcast-wpad-discover.nse +222 -0
- nse-library/scripts/broadcast-wsdd-discover.nse +102 -0
- nse-library/scripts/broadcast-xdmcp-discover.nse +73 -0
- nse-library/scripts/cassandra-brute.nse +132 -0
- nse-library/scripts/cassandra-info.nse +94 -0
- nse-library/scripts/cccam-version.nse +63 -0
- nse-library/scripts/cics-enum.nse +430 -0
- nse-library/scripts/cics-info.nse +409 -0
- nse-library/scripts/cics-user-brute.nse +299 -0
- nse-library/scripts/cics-user-enum.nse +255 -0
- nse-library/scripts/citrix-brute-xml.nse +163 -0
- nse-library/scripts/citrix-enum-apps-xml.nse +154 -0
- nse-library/scripts/citrix-enum-apps.nse +159 -0
- nse-library/scripts/citrix-enum-servers-xml.nse +47 -0
- nse-library/scripts/citrix-enum-servers.nse +145 -0
- nse-library/scripts/clamav-exec.nse +220 -0
- nse-library/scripts/clock-skew.nse +179 -0
- nse-library/scripts/coap-resources.nse +316 -0
- nse-library/scripts/couchdb-databases.nse +97 -0
- nse-library/scripts/couchdb-stats.nse +225 -0
- nse-library/scripts/creds-summary.nse +41 -0
- nse-library/scripts/cups-info.nse +73 -0
- nse-library/scripts/cups-queue-info.nse +42 -0
- nse-library/scripts/cvs-brute-repository.nse +129 -0
- nse-library/scripts/cvs-brute.nse +106 -0
- nse-library/scripts/daap-get-library.nse +332 -0
- nse-library/scripts/daytime.nse +26 -0
- nse-library/scripts/db2-das-info.nse +440 -0
- nse-library/scripts/deluge-rpc-brute.nse +167 -0
- nse-library/scripts/dhcp-discover.nse +228 -0
- nse-library/scripts/dicom-brute.nse +80 -0
- nse-library/scripts/dicom-cfind-ls.nse +801 -0
- nse-library/scripts/dicom-cmove.nse +583 -0
- nse-library/scripts/dicom-get.nse +656 -0
- nse-library/scripts/dicom-info.nse +743 -0
- nse-library/scripts/dicom-ping.nse +70 -0
- nse-library/scripts/dicom-slowloris.nse +495 -0
- nse-library/scripts/dicom-store-fuzzer.nse +790 -0
- nse-library/scripts/dicom-store-inject.nse +279 -0
- nse-library/scripts/dicom-web-enum.nse +497 -0
- nse-library/scripts/dict-info.nse +79 -0
- nse-library/scripts/distcc-cve2004-2687.nse +108 -0
- nse-library/scripts/dns-blacklist.nse +176 -0
- nse-library/scripts/dns-brute.nse +328 -0
- nse-library/scripts/dns-cache-snoop.nse +233 -0
- nse-library/scripts/dns-check-zone.nse +449 -0
- nse-library/scripts/dns-client-subnet-scan.nse +359 -0
- nse-library/scripts/dns-fuzz.nse +306 -0
- nse-library/scripts/dns-ip6-arpa-scan.nse +131 -0
- nse-library/scripts/dns-nsec-enum.nse +393 -0
- nse-library/scripts/dns-nsec3-enum.nse +427 -0
- nse-library/scripts/dns-nsid.nse +117 -0
- nse-library/scripts/dns-random-srcport.nse +153 -0
- nse-library/scripts/dns-random-txid.nse +153 -0
- nse-library/scripts/dns-recursion.nse +58 -0
- nse-library/scripts/dns-service-discovery.nse +67 -0
- nse-library/scripts/dns-srv-enum.nse +179 -0
- nse-library/scripts/dns-update.nse +118 -0
- nse-library/scripts/dns-zeustracker.nse +61 -0
- nse-library/scripts/dns-zone-transfer.nse +621 -0
- nse-library/scripts/docker-version.nse +46 -0
- nse-library/scripts/domcon-brute.nse +168 -0
- nse-library/scripts/domcon-cmd.nse +141 -0
- nse-library/scripts/domino-enum-users.nse +135 -0
- nse-library/scripts/dpap-brute.nse +127 -0
- nse-library/scripts/drda-brute.nse +173 -0
- nse-library/scripts/drda-info.nse +114 -0
- nse-library/scripts/duplicates.nse +243 -0
- nse-library/scripts/eap-info.nse +186 -0
- nse-library/scripts/enip-info.nse +1765 -0
- nse-library/scripts/epmd-info.nse +69 -0
- nse-library/scripts/eppc-enum-processes.nse +105 -0
- nse-library/scripts/fcrdns.nse +141 -0
- nse-library/scripts/finger.nse +37 -0
- nse-library/scripts/fingerprint-strings.nse +136 -0
- nse-library/scripts/firewalk.nse +1062 -0
- nse-library/scripts/firewall-bypass.nse +274 -0
- nse-library/scripts/flume-master-info.nse +296 -0
- nse-library/scripts/fox-info.nse +139 -0
- nse-library/scripts/freelancer-info.nse +107 -0
- nse-library/scripts/ftp-anon.nse +143 -0
- nse-library/scripts/ftp-bounce.nse +112 -0
- nse-library/scripts/ftp-brute.nse +112 -0
- nse-library/scripts/ftp-libopie.nse +101 -0
- nse-library/scripts/ftp-proftpd-backdoor.nse +127 -0
- nse-library/scripts/ftp-syst.nse +144 -0
- nse-library/scripts/ftp-vsftpd-backdoor.nse +192 -0
- nse-library/scripts/ftp-vuln-cve2010-4221.nse +198 -0
- nse-library/scripts/ganglia-info.nse +244 -0
- nse-library/scripts/giop-info.nse +81 -0
- nse-library/scripts/gkrellm-info.nse +205 -0
- nse-library/scripts/gopher-ls.nse +92 -0
- nse-library/scripts/gpsd-info.nse +105 -0
- nse-library/scripts/hadoop-datanode-info.nse +61 -0
- nse-library/scripts/hadoop-jobtracker-info.nse +181 -0
- nse-library/scripts/hadoop-namenode-info.nse +180 -0
- nse-library/scripts/hadoop-secondary-namenode-info.nse +122 -0
- nse-library/scripts/hadoop-tasktracker-info.nse +80 -0
- nse-library/scripts/hartip-info.nse +302 -0
- nse-library/scripts/hbase-master-info.nse +145 -0
- nse-library/scripts/hbase-region-info.nse +94 -0
- nse-library/scripts/hddtemp-info.nse +69 -0
- nse-library/scripts/hnap-info.nse +130 -0
- nse-library/scripts/hostmap-crtsh.nse +168 -0
- nse-library/scripts/hostmap-robtex.nse +85 -0
- nse-library/scripts/http-adobe-coldfusion-apsa1301.nse +66 -0
- nse-library/scripts/http-affiliate-id.nse +167 -0
- nse-library/scripts/http-apache-negotiation.nse +66 -0
- nse-library/scripts/http-apache-server-status.nse +126 -0
- nse-library/scripts/http-aspnet-debug.nse +60 -0
- nse-library/scripts/http-auth-finder.nse +119 -0
- nse-library/scripts/http-auth.nse +106 -0
- nse-library/scripts/http-avaya-ipoffice-users.nse +77 -0
- nse-library/scripts/http-awstatstotals-exec.nse +136 -0
- nse-library/scripts/http-axis2-dir-traversal.nse +197 -0
- nse-library/scripts/http-backup-finder.nse +157 -0
- nse-library/scripts/http-barracuda-dir-traversal.nse +184 -0
- nse-library/scripts/http-bigip-cookie.nse +83 -0
- nse-library/scripts/http-brute.nse +165 -0
- nse-library/scripts/http-cakephp-version.nse +113 -0
- nse-library/scripts/http-chrono.nse +136 -0
- nse-library/scripts/http-cisco-anyconnect.nse +60 -0
- nse-library/scripts/http-coldfusion-subzero.nse +147 -0
- nse-library/scripts/http-comments-displayer.nse +156 -0
- nse-library/scripts/http-config-backup.nse +245 -0
- nse-library/scripts/http-cookie-flags.nse +173 -0
- nse-library/scripts/http-cors.nse +100 -0
- nse-library/scripts/http-cross-domain-policy.nse +306 -0
- nse-library/scripts/http-csrf.nse +187 -0
- nse-library/scripts/http-date.nse +58 -0
- nse-library/scripts/http-default-accounts.nse +558 -0
- nse-library/scripts/http-devframework.nse +152 -0
- nse-library/scripts/http-dlink-backdoor.nse +70 -0
- nse-library/scripts/http-dombased-xss.nse +154 -0
- nse-library/scripts/http-domino-enum-passwords.nse +354 -0
- nse-library/scripts/http-drupal-enum-users.nse +82 -0
- nse-library/scripts/http-drupal-enum.nse +233 -0
- nse-library/scripts/http-enum.nse +512 -0
- nse-library/scripts/http-errors.nse +130 -0
- nse-library/scripts/http-exif-spider.nse +539 -0
- nse-library/scripts/http-favicon.nse +175 -0
- nse-library/scripts/http-feed.nse +159 -0
- nse-library/scripts/http-fetch.nse +251 -0
- nse-library/scripts/http-fileupload-exploiter.nse +342 -0
- nse-library/scripts/http-form-brute.nse +588 -0
- nse-library/scripts/http-form-fuzzer.nse +205 -0
- nse-library/scripts/http-frontpage-login.nse +84 -0
- nse-library/scripts/http-generator.nse +62 -0
- nse-library/scripts/http-git.nse +309 -0
- nse-library/scripts/http-gitweb-projects-enum.nse +106 -0
- nse-library/scripts/http-google-malware.nse +109 -0
- nse-library/scripts/http-grep.nse +326 -0
- nse-library/scripts/http-headers.nse +66 -0
- nse-library/scripts/http-hp-ilo-info.nse +120 -0
- nse-library/scripts/http-huawei-hg5xx-vuln.nse +131 -0
- nse-library/scripts/http-icloud-findmyiphone.nse +87 -0
- nse-library/scripts/http-icloud-sendmsg.nse +113 -0
- nse-library/scripts/http-iis-short-name-brute.nse +181 -0
- nse-library/scripts/http-iis-webdav-vuln.nse +220 -0
- nse-library/scripts/http-internal-ip-disclosure.nse +89 -0
- nse-library/scripts/http-joomla-brute.nse +147 -0
- nse-library/scripts/http-jsonp-detection.nse +190 -0
- nse-library/scripts/http-litespeed-sourcecode-download.nse +75 -0
- nse-library/scripts/http-ls.nse +193 -0
- nse-library/scripts/http-majordomo2-dir-traversal.nse +96 -0
- nse-library/scripts/http-malware-host.nse +81 -0
- nse-library/scripts/http-mcmp.nse +70 -0
- nse-library/scripts/http-method-tamper.nse +176 -0
- nse-library/scripts/http-methods.nse +235 -0
- nse-library/scripts/http-mobileversion-checker.nse +87 -0
- nse-library/scripts/http-ntlm-info.nse +131 -0
- nse-library/scripts/http-open-proxy.nse +213 -0
- nse-library/scripts/http-open-redirect.nse +136 -0
- nse-library/scripts/http-passwd.nse +198 -0
- nse-library/scripts/http-php-version.nse +166 -0
- nse-library/scripts/http-phpmyadmin-dir-traversal.nse +149 -0
- nse-library/scripts/http-phpself-xss.nse +168 -0
- nse-library/scripts/http-proxy-brute.nse +115 -0
- nse-library/scripts/http-put.nse +61 -0
- nse-library/scripts/http-qnap-nas-info.nse +118 -0
- nse-library/scripts/http-referer-checker.nse +89 -0
- nse-library/scripts/http-rfi-spider.nse +283 -0
- nse-library/scripts/http-robots.txt.nse +111 -0
- nse-library/scripts/http-robtex-reverse-ip.nse +81 -0
- nse-library/scripts/http-robtex-shared-ns.nse +111 -0
- nse-library/scripts/http-sap-netweaver-leak.nse +138 -0
- nse-library/scripts/http-security-headers.nse +315 -0
- nse-library/scripts/http-server-header.nse +106 -0
- nse-library/scripts/http-shellshock.nse +144 -0
- nse-library/scripts/http-sitemap-generator.nse +179 -0
- nse-library/scripts/http-slowloris-check.nse +164 -0
- nse-library/scripts/http-slowloris.nse +364 -0
- nse-library/scripts/http-sql-injection.nse +285 -0
- nse-library/scripts/http-stored-xss.nse +283 -0
- nse-library/scripts/http-svn-enum.nse +132 -0
- nse-library/scripts/http-svn-info.nse +130 -0
- nse-library/scripts/http-title.nse +82 -0
- nse-library/scripts/http-tplink-dir-traversal.nse +158 -0
- nse-library/scripts/http-trace.nse +72 -0
- nse-library/scripts/http-traceroute.nse +180 -0
- nse-library/scripts/http-trane-info.nse +167 -0
- nse-library/scripts/http-unsafe-output-escaping.nse +160 -0
- nse-library/scripts/http-useragent-tester.nse +193 -0
- nse-library/scripts/http-userdir-enum.nse +133 -0
- nse-library/scripts/http-vhosts.nse +179 -0
- nse-library/scripts/http-virustotal.nse +254 -0
- nse-library/scripts/http-vlcstreamer-ls.nse +86 -0
- nse-library/scripts/http-vmware-path-vuln.nse +141 -0
- nse-library/scripts/http-vuln-cve2006-3392.nse +79 -0
- nse-library/scripts/http-vuln-cve2009-3960.nse +163 -0
- nse-library/scripts/http-vuln-cve2010-0738.nse +79 -0
- nse-library/scripts/http-vuln-cve2010-2861.nse +143 -0
- nse-library/scripts/http-vuln-cve2011-3192.nse +128 -0
- nse-library/scripts/http-vuln-cve2011-3368.nse +160 -0
- nse-library/scripts/http-vuln-cve2012-1823.nse +102 -0
- nse-library/scripts/http-vuln-cve2013-0156.nse +123 -0
- nse-library/scripts/http-vuln-cve2013-6786.nse +78 -0
- nse-library/scripts/http-vuln-cve2013-7091.nse +121 -0
- nse-library/scripts/http-vuln-cve2014-2126.nse +88 -0
- nse-library/scripts/http-vuln-cve2014-2127.nse +88 -0
- nse-library/scripts/http-vuln-cve2014-2128.nse +89 -0
- nse-library/scripts/http-vuln-cve2014-2129.nse +86 -0
- nse-library/scripts/http-vuln-cve2014-3704.nse +430 -0
- nse-library/scripts/http-vuln-cve2014-8877.nse +134 -0
- nse-library/scripts/http-vuln-cve2015-1427.nse +210 -0
- nse-library/scripts/http-vuln-cve2015-1635.nse +86 -0
- nse-library/scripts/http-vuln-cve2017-1001000.nse +126 -0
- nse-library/scripts/http-vuln-cve2017-5638.nse +78 -0
- nse-library/scripts/http-vuln-cve2017-5689.nse +127 -0
- nse-library/scripts/http-vuln-cve2017-8917.nse +143 -0
- nse-library/scripts/http-vuln-misfortune-cookie.nse +77 -0
- nse-library/scripts/http-vuln-wnr1000-creds.nse +103 -0
- nse-library/scripts/http-waf-detect.nse +129 -0
- nse-library/scripts/http-waf-fingerprint.nse +677 -0
- nse-library/scripts/http-webdav-scan.nse +182 -0
- nse-library/scripts/http-wordpress-brute.nse +141 -0
- nse-library/scripts/http-wordpress-enum.nse +299 -0
- nse-library/scripts/http-wordpress-users.nse +149 -0
- nse-library/scripts/http-xssed.nse +92 -0
- nse-library/scripts/https-redirect.nse +78 -0
- nse-library/scripts/iax2-brute.nse +76 -0
- nse-library/scripts/iax2-version.nse +55 -0
- nse-library/scripts/icap-info.nse +119 -0
- nse-library/scripts/iec-identify.nse +161 -0
- nse-library/scripts/iec61850-mms.nse +380 -0
- nse-library/scripts/ike-version.nse +171 -0
- nse-library/scripts/imap-brute.nse +144 -0
- nse-library/scripts/imap-capabilities.nse +53 -0
- nse-library/scripts/imap-ntlm-info.nse +176 -0
- nse-library/scripts/impress-remote-discover.nse +213 -0
- nse-library/scripts/informix-brute.nse +111 -0
- nse-library/scripts/informix-query.nse +94 -0
- nse-library/scripts/informix-tables.nse +122 -0
- nse-library/scripts/ip-forwarding.nse +113 -0
- nse-library/scripts/ip-geolocation-geoplugin.nse +72 -0
- nse-library/scripts/ip-geolocation-ipinfodb.nse +96 -0
- nse-library/scripts/ip-geolocation-map-bing.nse +191 -0
- nse-library/scripts/ip-geolocation-map-google.nse +181 -0
- nse-library/scripts/ip-geolocation-map-kml.nse +90 -0
- nse-library/scripts/ip-geolocation-maxmind.nse +628 -0
- nse-library/scripts/ip-https-discover.nse +76 -0
- nse-library/scripts/ipidseq.nse +238 -0
- nse-library/scripts/ipmi-brute.nse +130 -0
- nse-library/scripts/ipmi-cipher-zero.nse +102 -0
- nse-library/scripts/ipmi-version.nse +170 -0
- nse-library/scripts/ipv6-multicast-mld-list.nse +390 -0
- nse-library/scripts/ipv6-node-info.nse +337 -0
- nse-library/scripts/ipv6-ra-flood.nse +193 -0
- nse-library/scripts/irc-botnet-channels.nse +279 -0
- nse-library/scripts/irc-brute.nse +136 -0
- nse-library/scripts/irc-info.nse +166 -0
- nse-library/scripts/irc-sasl-brute.nse +204 -0
- nse-library/scripts/irc-unrealircd-backdoor.nse +223 -0
- nse-library/scripts/iscsi-brute.nse +91 -0
- nse-library/scripts/iscsi-info.nse +106 -0
- nse-library/scripts/isns-info.nse +71 -0
- nse-library/scripts/jdwp-exec.nse +97 -0
- nse-library/scripts/jdwp-info.nse +93 -0
- nse-library/scripts/jdwp-inject.nse +87 -0
- nse-library/scripts/jdwp-version.nse +59 -0
- nse-library/scripts/knx-gateway-discover.nse +309 -0
- nse-library/scripts/knx-gateway-info.nse +147 -0
- nse-library/scripts/krb5-enum-users.nse +404 -0
- nse-library/scripts/ldap-brute.nse +316 -0
- nse-library/scripts/ldap-novell-getpass.nse +139 -0
- nse-library/scripts/ldap-rootdse.nse +212 -0
- nse-library/scripts/ldap-search.nse +315 -0
- nse-library/scripts/lexmark-config.nse +88 -0
- nse-library/scripts/llmnr-resolve.nse +220 -0
- nse-library/scripts/lltd-discovery.nse +300 -0
- nse-library/scripts/lu-enum.nse +217 -0
- nse-library/scripts/maxdb-info.nse +179 -0
- nse-library/scripts/mcafee-epo-agent.nse +77 -0
- nse-library/scripts/membase-brute.nse +113 -0
- nse-library/scripts/membase-http-info.nse +151 -0
- nse-library/scripts/memcached-info.nse +184 -0
- nse-library/scripts/metasploit-info.nse +287 -0
- nse-library/scripts/metasploit-msgrpc-brute.nse +110 -0
- nse-library/scripts/metasploit-xmlrpc-brute.nse +99 -0
- nse-library/scripts/mikrotik-routeros-brute.nse +99 -0
- nse-library/scripts/mikrotik-routeros-username-brute.nse +138 -0
- nse-library/scripts/mikrotik-routeros-version.nse +238 -0
- nse-library/scripts/mmouse-brute.nse +120 -0
- nse-library/scripts/mmouse-exec.nse +180 -0
- nse-library/scripts/modbus-discover.nse +163 -0
- nse-library/scripts/mongodb-brute.nse +108 -0
- nse-library/scripts/mongodb-databases.nse +100 -0
- nse-library/scripts/mongodb-info.nse +132 -0
- nse-library/scripts/mqtt-subscribe.nse +393 -0
- nse-library/scripts/mrinfo.nse +297 -0
- nse-library/scripts/ms-sql-brute.nse +290 -0
- nse-library/scripts/ms-sql-config.nse +132 -0
- nse-library/scripts/ms-sql-dac.nse +85 -0
- nse-library/scripts/ms-sql-dump-hashes.nse +113 -0
- nse-library/scripts/ms-sql-empty-password.nse +163 -0
- nse-library/scripts/ms-sql-hasdbaccess.nse +150 -0
- nse-library/scripts/ms-sql-info.nse +237 -0
- nse-library/scripts/ms-sql-ntlm-info.nse +134 -0
- nse-library/scripts/ms-sql-query.nse +107 -0
- nse-library/scripts/ms-sql-tables.nse +253 -0
- nse-library/scripts/ms-sql-xp-cmdshell.nse +153 -0
- nse-library/scripts/msrpc-enum.nse +112 -0
- nse-library/scripts/mtrace.nse +386 -0
- nse-library/scripts/multicast-profinet-discovery.nse +346 -0
- nse-library/scripts/murmur-version.nse +101 -0
- nse-library/scripts/mysql-audit.nse +184 -0
- nse-library/scripts/mysql-brute.nse +99 -0
- nse-library/scripts/mysql-databases.nse +98 -0
- nse-library/scripts/mysql-dump-hashes.nse +113 -0
- nse-library/scripts/mysql-empty-password.nse +67 -0
- nse-library/scripts/mysql-enum.nse +113 -0
- nse-library/scripts/mysql-info.nse +132 -0
- nse-library/scripts/mysql-query.nse +118 -0
- nse-library/scripts/mysql-users.nse +97 -0
- nse-library/scripts/mysql-variables.nse +109 -0
- nse-library/scripts/mysql-vuln-cve2012-2122.nse +153 -0
- nse-library/scripts/nat-pmp-info.nse +47 -0
- nse-library/scripts/nat-pmp-mapport.nse +117 -0
- nse-library/scripts/nbd-info.nse +197 -0
- nse-library/scripts/nbns-interfaces.nse +69 -0
- nse-library/scripts/nbstat.nse +244 -0
- nse-library/scripts/ncp-enum-users.nse +54 -0
- nse-library/scripts/ncp-serverinfo.nse +51 -0
- nse-library/scripts/ndmp-fs-info.nse +72 -0
- nse-library/scripts/ndmp-version.nse +71 -0
- nse-library/scripts/nessus-brute.nse +153 -0
- nse-library/scripts/nessus-xmlrpc-brute.nse +130 -0
- nse-library/scripts/netbus-auth-bypass.nse +63 -0
- nse-library/scripts/netbus-brute.nse +63 -0
- nse-library/scripts/netbus-info.nse +200 -0
- nse-library/scripts/netbus-version.nse +54 -0
- nse-library/scripts/nexpose-brute.nse +83 -0
- nse-library/scripts/nfs-ls.nse +470 -0
- nse-library/scripts/nfs-showmount.nse +97 -0
- nse-library/scripts/nfs-statfs.nse +359 -0
- nse-library/scripts/nje-node-brute.nse +175 -0
- nse-library/scripts/nje-pass-brute.nse +148 -0
- nse-library/scripts/nntp-ntlm-info.nse +162 -0
- nse-library/scripts/nping-brute.nse +145 -0
- nse-library/scripts/nrpe-enum.nse +241 -0
- nse-library/scripts/ntp-info.nse +172 -0
- nse-library/scripts/ntp-monlist.nse +1036 -0
- nse-library/scripts/omp2-brute.nse +81 -0
- nse-library/scripts/omp2-enum-targets.nse +126 -0
- nse-library/scripts/omron-info.nse +197 -0
- nse-library/scripts/openflow-info.nse +205 -0
- nse-library/scripts/openlookup-info.nse +246 -0
- nse-library/scripts/openvas-otp-brute.nse +112 -0
- nse-library/scripts/openwebnet-discovery.nse +291 -0
- nse-library/scripts/oracle-brute-stealth.nse +207 -0
- nse-library/scripts/oracle-brute.nse +228 -0
- nse-library/scripts/oracle-enum-users.nse +134 -0
- nse-library/scripts/oracle-sid-brute.nse +171 -0
- nse-library/scripts/oracle-tns-version.nse +104 -0
- nse-library/scripts/ovs-agent-version.nse +78 -0
- nse-library/scripts/p2p-conficker.nse +651 -0
- nse-library/scripts/path-mtu.nse +402 -0
- nse-library/scripts/pcanywhere-brute.nse +158 -0
- nse-library/scripts/pcworx-info.nse +111 -0
- nse-library/scripts/pgsql-brute.nse +169 -0
- nse-library/scripts/pjl-ready-message.nse +105 -0
- nse-library/scripts/pop3-brute.nse +136 -0
- nse-library/scripts/pop3-capabilities.nse +47 -0
- nse-library/scripts/pop3-ntlm-info.nse +161 -0
- nse-library/scripts/port-states.nse +86 -0
- nse-library/scripts/pptp-version.nse +81 -0
- nse-library/scripts/profinet-cm-lookup.nse +166 -0
- nse-library/scripts/puppet-naivesigning.nse +192 -0
- nse-library/scripts/qconn-exec.nse +114 -0
- nse-library/scripts/qscan.nse +504 -0
- nse-library/scripts/quake1-info.nse +319 -0
- nse-library/scripts/quake3-info.nse +256 -0
- nse-library/scripts/quake3-master-getservers.nse +249 -0
- nse-library/scripts/rdp-enum-encryption.nse +213 -0
- nse-library/scripts/rdp-ntlm-info.nse +168 -0
- nse-library/scripts/rdp-vuln-ms12-020.nse +237 -0
- nse-library/scripts/realvnc-auth-bypass.nse +110 -0
- nse-library/scripts/redis-brute.nse +113 -0
- nse-library/scripts/redis-info.nse +250 -0
- nse-library/scripts/resolveall.nse +170 -0
- nse-library/scripts/reverse-index.nse +121 -0
- nse-library/scripts/rexec-brute.nse +113 -0
- nse-library/scripts/rfc868-time.nse +65 -0
- nse-library/scripts/riak-http-info.nse +145 -0
- nse-library/scripts/rlogin-brute.nse +163 -0
- nse-library/scripts/rmi-dumpregistry.nse +231 -0
- nse-library/scripts/rmi-vuln-classloader.nse +115 -0
- nse-library/scripts/rpc-grind.nse +271 -0
- nse-library/scripts/rpcap-brute.nse +94 -0
- nse-library/scripts/rpcap-info.nse +94 -0
- nse-library/scripts/rpcinfo.nse +134 -0
- nse-library/scripts/rsa-vuln-roca.nse +176 -0
- nse-library/scripts/rsync-brute.nse +110 -0
- nse-library/scripts/rsync-list-modules.nse +62 -0
- nse-library/scripts/rtsp-methods.nse +58 -0
- nse-library/scripts/rtsp-url-brute.nse +202 -0
- nse-library/scripts/rusers.nse +176 -0
- nse-library/scripts/s7-info.nse +271 -0
- nse-library/scripts/samba-vuln-cve-2012-1182.nse +130 -0
- nse-library/scripts/script.db +619 -0
- nse-library/scripts/servicetags.nse +297 -0
- nse-library/scripts/shodan-api.nse +223 -0
- nse-library/scripts/sip-brute.nse +111 -0
- nse-library/scripts/sip-call-spoof.nse +170 -0
- nse-library/scripts/sip-enum-users.nse +266 -0
- nse-library/scripts/sip-methods.nse +65 -0
- nse-library/scripts/skypev2-version.nse +80 -0
- nse-library/scripts/smb-brute.nse +1114 -0
- nse-library/scripts/smb-double-pulsar-backdoor.nse +146 -0
- nse-library/scripts/smb-enum-domains.nse +123 -0
- nse-library/scripts/smb-enum-groups.nse +174 -0
- nse-library/scripts/smb-enum-processes.nse +278 -0
- nse-library/scripts/smb-enum-services.nse +921 -0
- nse-library/scripts/smb-enum-sessions.nse +328 -0
- nse-library/scripts/smb-enum-shares.nse +194 -0
- nse-library/scripts/smb-enum-users.nse +267 -0
- nse-library/scripts/smb-flood.nse +146 -0
- nse-library/scripts/smb-ls.nse +218 -0
- nse-library/scripts/smb-mbenum.nse +246 -0
- nse-library/scripts/smb-os-discovery.nse +220 -0
- nse-library/scripts/smb-print-text.nse +133 -0
- nse-library/scripts/smb-protocols.nse +71 -0
- nse-library/scripts/smb-psexec.nse +1565 -0
- nse-library/scripts/smb-security-mode.nse +158 -0
- nse-library/scripts/smb-server-stats.nse +66 -0
- nse-library/scripts/smb-system-info.nse +249 -0
- nse-library/scripts/smb-vuln-conficker.nse +188 -0
- nse-library/scripts/smb-vuln-cve-2017-7494.nse +517 -0
- nse-library/scripts/smb-vuln-cve2009-3103.nse +174 -0
- nse-library/scripts/smb-vuln-ms06-025.nse +163 -0
- nse-library/scripts/smb-vuln-ms07-029.nse +150 -0
- nse-library/scripts/smb-vuln-ms08-067.nse +154 -0
- nse-library/scripts/smb-vuln-ms10-054.nse +144 -0
- nse-library/scripts/smb-vuln-ms10-061.nse +171 -0
- nse-library/scripts/smb-vuln-ms17-010.nse +192 -0
- nse-library/scripts/smb-vuln-regsvc-dos.nse +124 -0
- nse-library/scripts/smb-vuln-webexec.nse +167 -0
- nse-library/scripts/smb-webexec-exploit.nse +140 -0
- nse-library/scripts/smb2-capabilities.nse +129 -0
- nse-library/scripts/smb2-security-mode.nse +88 -0
- nse-library/scripts/smb2-time.nse +51 -0
- nse-library/scripts/smb2-vuln-uptime.nse +157 -0
- nse-library/scripts/smtp-brute.nse +140 -0
- nse-library/scripts/smtp-commands.nse +131 -0
- nse-library/scripts/smtp-enum-users.nse +382 -0
- nse-library/scripts/smtp-ntlm-info.nse +189 -0
- nse-library/scripts/smtp-open-relay.nse +288 -0
- nse-library/scripts/smtp-strangeport.nse +29 -0
- nse-library/scripts/smtp-vuln-cve2010-4344.nse +461 -0
- nse-library/scripts/smtp-vuln-cve2011-1720.nse +285 -0
- nse-library/scripts/smtp-vuln-cve2011-1764.nse +235 -0
- nse-library/scripts/sniffer-detect.nse +144 -0
- nse-library/scripts/snmp-brute.nse +278 -0
- nse-library/scripts/snmp-hh3c-logins.nse +148 -0
- nse-library/scripts/snmp-info.nse +145 -0
- nse-library/scripts/snmp-interfaces.nse +736 -0
- nse-library/scripts/snmp-ios-config.nse +178 -0
- nse-library/scripts/snmp-netstat.nse +138 -0
- nse-library/scripts/snmp-processes.nse +162 -0
- nse-library/scripts/snmp-sysdescr.nse +69 -0
- nse-library/scripts/snmp-win32-services.nse +95 -0
- nse-library/scripts/snmp-win32-shares.nse +100 -0
- nse-library/scripts/snmp-win32-software.nse +163 -0
- nse-library/scripts/snmp-win32-users.nse +92 -0
- nse-library/scripts/socks-auth-info.nse +65 -0
- nse-library/scripts/socks-brute.nse +102 -0
- nse-library/scripts/socks-open-proxy.nse +191 -0
- nse-library/scripts/ssh-auth-methods.nse +55 -0
- nse-library/scripts/ssh-brute.nse +108 -0
- nse-library/scripts/ssh-hostkey.nse +426 -0
- nse-library/scripts/ssh-publickey-acceptance.nse +166 -0
- nse-library/scripts/ssh-run.nse +104 -0
- nse-library/scripts/ssh2-enum-algos.nse +212 -0
- nse-library/scripts/sshv1.nse +74 -0
- nse-library/scripts/ssl-ccs-injection.nse +328 -0
- nse-library/scripts/ssl-cert-intaddr.nse +149 -0
- nse-library/scripts/ssl-cert.nse +376 -0
- nse-library/scripts/ssl-date.nse +215 -0
- nse-library/scripts/ssl-dh-params.nse +941 -0
- nse-library/scripts/ssl-enum-ciphers.nse +1142 -0
- nse-library/scripts/ssl-heartbleed.nse +238 -0
- nse-library/scripts/ssl-known-key.nse +138 -0
- nse-library/scripts/ssl-poodle.nse +357 -0
- nse-library/scripts/sslv2-drown.nse +341 -0
- nse-library/scripts/sslv2.nse +57 -0
- nse-library/scripts/sstp-discover.nse +80 -0
- nse-library/scripts/stun-info.nse +49 -0
- nse-library/scripts/stun-version.nse +44 -0
- nse-library/scripts/stuxnet-detect.nse +119 -0
- nse-library/scripts/supermicro-ipmi-conf.nse +99 -0
- nse-library/scripts/svn-brute.nse +273 -0
- nse-library/scripts/targets-asn.nse +101 -0
- nse-library/scripts/targets-ipv6-eui64.nse +121 -0
- nse-library/scripts/targets-ipv6-map4to6.nse +247 -0
- nse-library/scripts/targets-ipv6-multicast-echo.nse +151 -0
- nse-library/scripts/targets-ipv6-multicast-invalid-dst.nse +182 -0
- nse-library/scripts/targets-ipv6-multicast-mld.nse +137 -0
- nse-library/scripts/targets-ipv6-multicast-slaac.nse +238 -0
- nse-library/scripts/targets-ipv6-wordlist.nse +283 -0
- nse-library/scripts/targets-sniffer.nse +163 -0
- nse-library/scripts/targets-traceroute.nse +64 -0
- nse-library/scripts/targets-xml.nse +142 -0
- nse-library/scripts/teamspeak2-version.nse +71 -0
- nse-library/scripts/telnet-brute.nse +698 -0
- nse-library/scripts/telnet-encryption.nse +106 -0
- nse-library/scripts/telnet-ntlm-info.nse +141 -0
- nse-library/scripts/tftp-enum.nse +212 -0
- nse-library/scripts/tftp-version.nse +321 -0
- nse-library/scripts/tls-alpn.nse +244 -0
- nse-library/scripts/tls-nextprotoneg.nse +160 -0
- nse-library/scripts/tls-ticketbleed.nse +360 -0
- nse-library/scripts/tn3270-screen.nse +122 -0
- nse-library/scripts/tor-consensus-checker.nse +135 -0
- nse-library/scripts/traceroute-geolocation.nse +187 -0
- nse-library/scripts/tso-brute.nse +368 -0
- nse-library/scripts/tso-enum.nse +291 -0
- nse-library/scripts/ubiquiti-discovery.nse +375 -0
- nse-library/scripts/unittest.nse +44 -0
- nse-library/scripts/unusual-port.nse +130 -0
- nse-library/scripts/upnp-info.nse +57 -0
- nse-library/scripts/uptime-agent-info.nse +95 -0
- nse-library/scripts/url-snarf.nse +154 -0
- nse-library/scripts/ventrilo-info.nse +665 -0
- nse-library/scripts/versant-info.nse +115 -0
- nse-library/scripts/vmauthd-brute.nse +121 -0
- nse-library/scripts/vmware-version.nse +88 -0
- nse-library/scripts/vnc-brute.nse +152 -0
- nse-library/scripts/vnc-info.nse +163 -0
- nse-library/scripts/vnc-title.nse +104 -0
- nse-library/scripts/voldemort-info.nse +173 -0
- nse-library/scripts/vtam-enum.nse +278 -0
- nse-library/scripts/vulners.nse +249 -0
- nse-library/scripts/vuze-dht-info.nse +88 -0
- nse-library/scripts/wdb-version.nse +222 -0
- nse-library/scripts/weblogic-t3-info.nse +94 -0
- nse-library/scripts/whois-domain.nse +173 -0
- nse-library/scripts/whois-ip.nse +2263 -0
- nse-library/scripts/wsdd-discover.nse +91 -0
- nse-library/scripts/x11-access.nse +74 -0
- nse-library/scripts/xdmcp-discover.nse +67 -0
- nse-library/scripts/xmlrpc-methods.nse +120 -0
- nse-library/scripts/xmpp-brute.nse +142 -0
- nse-library/scripts/xmpp-info.nse +579 -0
- nse-library/sources/cldrn/README.md +10 -0
- nse-library/sources/cldrn/UPDATES +1 -0
- nse-library/sources/cldrn/count_targets.sh +10 -0
- nse-library/sources/cldrn/data/http-default-accounts-fingerprints.lua +125 -0
- nse-library/sources/cldrn/data/http-fingerprints.lua +11424 -0
- nse-library/sources/cldrn/data/huawei-udp-info.bin +0 -0
- nse-library/sources/cldrn/nmap-mon.sh +35 -0
- nse-library/sources/cldrn/nmap-nse-linter.sh +196 -0
- nse-library/sources/cldrn/nse-script-template.nse +21 -0
- nse-library/sources/cldrn/nsedoc.tar.gz +0 -0
- nse-library/sources/cldrn/nselib/brute.lua +1556 -0
- nse-library/sources/cldrn/nselib/data/http-fingerprints.lua +12054 -0
- nse-library/sources/cldrn/nselib/dicom.lua +272 -0
- nse-library/sources/cldrn/nselib/http.lua +2622 -0
- nse-library/sources/cldrn/nselib/httpspider.lua +725 -0
- nse-library/sources/cldrn/nselib/smb.lua +4316 -0
- nse-library/sources/cldrn/nselib/stdnse.lua +964 -0
- nse-library/sources/cldrn/old-scripts/hostmap.nse +207 -0
- nse-library/sources/cldrn/old-scripts/http-awstatstotals-exec.nse +130 -0
- nse-library/sources/cldrn/old-scripts/http-axis2-dir-traversal.nse +188 -0
- nse-library/sources/cldrn/old-scripts/http-brute.nse +124 -0
- nse-library/sources/cldrn/old-scripts/http-cakephp-version.nse +99 -0
- nse-library/sources/cldrn/old-scripts/http-default-accounts.nse +286 -0
- nse-library/sources/cldrn/old-scripts/http-email-harvest.nse +59 -0
- nse-library/sources/cldrn/old-scripts/http-form-brute.nse +244 -0
- nse-library/sources/cldrn/old-scripts/http-google-malware.nse +95 -0
- nse-library/sources/cldrn/old-scripts/http-huawei-hg5xx-vuln.nse +109 -0
- nse-library/sources/cldrn/old-scripts/http-joomla-brute.nse +146 -0
- nse-library/sources/cldrn/old-scripts/http-litespeed-sourcecode-download.nse +66 -0
- nse-library/sources/cldrn/old-scripts/http-majordomo2-dir-traversal.nse +90 -0
- nse-library/sources/cldrn/old-scripts/http-phpself-xss.nse +142 -0
- nse-library/sources/cldrn/old-scripts/http-phpselfxss-scan.nse +81 -0
- nse-library/sources/cldrn/old-scripts/http-sitemap-dump.nse +335 -0
- nse-library/sources/cldrn/old-scripts/http-sitemap.nse +42 -0
- nse-library/sources/cldrn/old-scripts/http-tomcat-brute.nse +116 -0
- nse-library/sources/cldrn/old-scripts/http-trace.nse +66 -0
- nse-library/sources/cldrn/old-scripts/http-vuln-cve2012-1823.nse +99 -0
- nse-library/sources/cldrn/old-scripts/http-waf-detect.nse +121 -0
- nse-library/sources/cldrn/old-scripts/http-wordpress-brute.nse +134 -0
- nse-library/sources/cldrn/old-scripts/http-wp-enum.nse +137 -0
- nse-library/sources/cldrn/old-scripts/huawei5xx-udp-info.nse +103 -0
- nse-library/sources/cldrn/scripts/dicom-brute.nse +80 -0
- nse-library/sources/cldrn/scripts/dicom-cfind-ls.nse +800 -0
- nse-library/sources/cldrn/scripts/dicom-cmove.nse +583 -0
- nse-library/sources/cldrn/scripts/dicom-get.nse +655 -0
- nse-library/sources/cldrn/scripts/dicom-info.nse +631 -0
- nse-library/sources/cldrn/scripts/dicom-ping.nse +70 -0
- nse-library/sources/cldrn/scripts/dicom-store-fuzzer.nse +789 -0
- nse-library/sources/cldrn/scripts/dicom.lua +1533 -0
- nse-library/sources/cldrn/scripts/dns-cname-dangling.nse +504 -0
- nse-library/sources/cldrn/scripts/dns-openresolvers-check.nse +84 -0
- nse-library/sources/cldrn/scripts/google-people-enum.nse +213 -0
- nse-library/sources/cldrn/scripts/hostmap-crtsh.nse +115 -0
- nse-library/sources/cldrn/scripts/hostmap-ip2hosts.nse +131 -0
- nse-library/sources/cldrn/scripts/hostmap.nse +207 -0
- nse-library/sources/cldrn/scripts/http-adobe-coldfusion-apsa1301.nse +58 -0
- nse-library/sources/cldrn/scripts/http-awstatstotals-exec.nse +134 -0
- nse-library/sources/cldrn/scripts/http-axis2-dir-traversal.nse +192 -0
- nse-library/sources/cldrn/scripts/http-brute.nse +130 -0
- nse-library/sources/cldrn/scripts/http-cakephp-version.nse +106 -0
- nse-library/sources/cldrn/scripts/http-coldfusion-subzero.nse +128 -0
- nse-library/sources/cldrn/scripts/http-default-accounts.nse +295 -0
- nse-library/sources/cldrn/scripts/http-email-harvest.nse +86 -0
- nse-library/sources/cldrn/scripts/http-form-brute.nse +251 -0
- nse-library/sources/cldrn/scripts/http-google-malware.nse +99 -0
- nse-library/sources/cldrn/scripts/http-httpoxy.nse +151 -0
- nse-library/sources/cldrn/scripts/http-huawei-hg5xx-vuln.nse +128 -0
- nse-library/sources/cldrn/scripts/http-iis-short-name-brute.nse +173 -0
- nse-library/sources/cldrn/scripts/http-iis-shortname-dos.nse +53 -0
- nse-library/sources/cldrn/scripts/http-joomla-brute.nse +150 -0
- nse-library/sources/cldrn/scripts/http-litespeed-sourcecode-download.nse +70 -0
- nse-library/sources/cldrn/scripts/http-majordomo2-dir-traversal.nse +95 -0
- nse-library/sources/cldrn/scripts/http-method-tamper.nse +168 -0
- nse-library/sources/cldrn/scripts/http-phpself-xss.nse +157 -0
- nse-library/sources/cldrn/scripts/http-shellshock-spider.nse +74 -0
- nse-library/sources/cldrn/scripts/http-tplink-dir-traversal.nse +155 -0
- nse-library/sources/cldrn/scripts/http-trace.nse +68 -0
- nse-library/sources/cldrn/scripts/http-trendnet-tvip110w.nse +39 -0
- nse-library/sources/cldrn/scripts/http-vuln-cve2012-1823.nse +99 -0
- nse-library/sources/cldrn/scripts/http-vuln-cve2013-0156.nse +121 -0
- nse-library/sources/cldrn/scripts/http-vuln-cve2015-1635.nse +85 -0
- nse-library/sources/cldrn/scripts/http-waf-detect.nse +124 -0
- nse-library/sources/cldrn/scripts/http-wordpress-brute.nse +136 -0
- nse-library/sources/cldrn/scripts/http-wordpress-enum.nse +146 -0
- nse-library/sources/cldrn/scripts/huawei5xx-udp-info.nse +105 -0
- nse-library/sources/cldrn/scripts/mikrotik-routeros-brute.nse +104 -0
- nse-library/sources/cldrn/scripts/mysql-vuln-cve2012-2122.nse +146 -0
- nse-library/sources/cldrn/scripts/smb-vuln-conficker.nse +190 -0
- nse-library/sources/cldrn/scripts/smb-vuln-cve2009-3103.nse +178 -0
- nse-library/sources/cldrn/scripts/smb-vuln-ms06-025.nse +165 -0
- nse-library/sources/cldrn/scripts/smb-vuln-ms07-029.nse +152 -0
- nse-library/sources/cldrn/scripts/smb-vuln-ms08-067.nse +157 -0
- nse-library/sources/cldrn/scripts/smb-vuln-ms17-010.nse +187 -0
- nse-library/sources/cldrn/scripts/smb-vuln-regsvc-dos.nse +126 -0
- nse-library/sources/cldrn/scripts/smtp-dovecot-exim-exec.nse +110 -0
- nse-library/sources/cldrn/scripts/vulscan.nse +538 -0
- nse-library/sources/cldrn/workshops/command-cheatsheet.md +29 -0
- nse-library/sources/cldrn/workshops/dc24/dotvimrc.txt +7 -0
- nse-library/sources/cldrn/workshops/dc24/fakewebapp/login.php +18 -0
- nse-library/sources/cldrn/workshops/dc24/http-shellshock-spider.nse +74 -0
- nse-library/sources/cldrn/workshops/dc24/nmap-check.sh +213 -0
- nse-library/sources/cldrn/workshops/dc24/nmap.jpg +0 -0
- nse-library/sources/cldrn/workshops/dc24/nse-script-template.nse +21 -0
- nse-library/sources/cldrn/workshops/dc24/sample-scan/scanme.gnmap +4 -0
- nse-library/sources/cldrn/workshops/dc24/sample-scan/scanme.nmap +15 -0
- nse-library/sources/cldrn/workshops/dc24/sample-scan/scanme.xml +28 -0
- nse-library/sources/cldrn/workshops/nmap-nse.odp +0 -0
- nse-library/sources/hackertarget/LICENSE +340 -0
- nse-library/sources/hackertarget/README.md +43 -0
- nse-library/sources/hackertarget/hostmap-hackertarget.nse +83 -0
- nse-library/sources/hackertarget/http-wordpress-info.nse +227 -0
- nse-library/sources/hackertarget/http-wordpress-plugins.nse +197 -0
- nse-library/sources/hackertarget/http-wordpress-themes.nse +192 -0
- nse-library/sources/hackertarget/wp-plugins.lst +56908 -0
- nse-library/sources/hackertarget/wp-themes.lst +14528 -0
- nse-library/sources/personal/exploit-xunlei-rce.nse +6 -0
- nse-library/sources/personal/my-dokuwiki-audit.nse +17 -0
- nse-library/sources/psc4re/CVE-2021-21972.nse +89 -0
- nse-library/sources/psc4re/README.md +98 -0
- nse-library/sources/psc4re/cve-2020-0796.nse +101 -0
- nse-library/sources/psc4re/cve-2020-1350.nse +89 -0
- nse-library/sources/psc4re/http-custom-title.nse +99 -0
- nse-library/sources/psc4re/proxyshell.nse +41 -0
- nse-library/sources/vulners/LICENSE +583 -0
- nse-library/sources/vulners/README.md +923 -0
- nse-library/sources/vulners/catalog/fingerprints.json +6960 -0
- nse-library/sources/vulners/catalog/index.json +19 -0
- nse-library/sources/vulners/catalog/paths.json +958 -0
- nse-library/sources/vulners/catalog/probes.json +180 -0
- nse-library/sources/vulners/install.ps1 +391 -0
- nse-library/sources/vulners/install.sh +428 -0
- nse-library/sources/vulners/vulners.nse +4395 -0
- nseft/__init__.py +3 -0
- nseft/calibration.json +14 -0
- nseft/data.py +145 -0
- nseft/doctor.py +112 -0
- nseft/grpo.py +53 -0
- nseft/library.py +225 -0
- nseft/model.py +143 -0
- nseft/output.py +100 -0
- nseft/personal.py +83 -0
- nseft/phronesis.py +65 -0
- nseft/profiles.py +111 -0
- nseft/rlvr.py +300 -0
- nseft/scoring.py +128 -0
- nseft/services.py +97 -0
- nseft/templates.py +136 -0
- nseft/update_db.py +408 -0
- nseft/weights.py +190 -0
- phronesis_nse-0.3.0.dist-info/METADATA +434 -0
- phronesis_nse-0.3.0.dist-info/RECORD +1001 -0
- phronesis_nse-0.3.0.dist-info/WHEEL +5 -0
- phronesis_nse-0.3.0.dist-info/entry_points.txt +2 -0
- phronesis_nse-0.3.0.dist-info/licenses/LICENSE +201 -0
- phronesis_nse-0.3.0.dist-info/top_level.txt +3 -0
nmap_select.py
ADDED
|
@@ -0,0 +1,801 @@
|
|
|
1
|
+
"""Phronesis NSE selector.
|
|
2
|
+
|
|
3
|
+
The default path reads an Nmap XML stream from stdin, chooses one NSE action per
|
|
4
|
+
open port, and prints the suggestion. It never runs a script unless --run is set.
|
|
5
|
+
"""
|
|
6
|
+
import argparse
|
|
7
|
+
import io
|
|
8
|
+
import ipaddress
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import re
|
|
12
|
+
import shutil
|
|
13
|
+
import subprocess
|
|
14
|
+
import sys
|
|
15
|
+
import tempfile
|
|
16
|
+
import time
|
|
17
|
+
import xml.etree.ElementTree as ET
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
from nseft.library import (
|
|
21
|
+
DEFAULT_CATEGORIES, EXTERNAL_CATEGORY, RISKY_CATEGORIES, default_safe,
|
|
22
|
+
hash_file, legacy_scripts_dir, load_catalog as load_library_catalog,
|
|
23
|
+
resolve_library, script_metadata,
|
|
24
|
+
)
|
|
25
|
+
from nseft.output import (Logger, result_json, result_line, shell_command, suggest_line, table,
|
|
26
|
+
write_file)
|
|
27
|
+
from nseft.personal import index_personal, merge_catalogs, personal_rows
|
|
28
|
+
from nseft.profiles import load_profile
|
|
29
|
+
from nseft.scoring import (TRAINED_MAX_CANDIDATES, TRAINED_MAX_PROMPT_TOKENS, in_training_range,
|
|
30
|
+
load_calibration, rank_candidates, softmax)
|
|
31
|
+
from nseft.services import infer_families
|
|
32
|
+
from nseft.templates import apply_templates, load_templates
|
|
33
|
+
from nseft.weights import WeightsError, resolve_model_dir
|
|
34
|
+
|
|
35
|
+
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
36
|
+
|
|
37
|
+
ROOT = Path(__file__).resolve().parent
|
|
38
|
+
CAT = ROOT / "data/nse-catalog.jsonl"
|
|
39
|
+
WINDOWS = os.name == "nt"
|
|
40
|
+
SCRIPTS_DIR = legacy_scripts_dir()
|
|
41
|
+
PERSONAL_DIR = Path(os.environ.get("NSE_PERSONAL", "D:/nse-scripts" if WINDOWS else "~/nse-scripts")).expanduser()
|
|
42
|
+
MODEL_DIR = resolve_model_dir(download=False, repo_root=ROOT)
|
|
43
|
+
FAMILY = {
|
|
44
|
+
"http": ("http-", "ssl-", "vhost-", "banner"), "https": ("http-", "ssl-", "banner"),
|
|
45
|
+
"ssh": ("ssh", "ssh2-", "banner"), "ftp": ("ftp-", "banner"),
|
|
46
|
+
"smtp": ("smtp-", "pop3-", "banner"), "pop3": ("pop3-", "banner"),
|
|
47
|
+
"redis": ("redis-", "banner"), "mysql": ("mysql-", "banner"),
|
|
48
|
+
"postgresql": ("pgsql-", "banner"), "memcached": ("memcached-", "banner"),
|
|
49
|
+
"imap": ("imap-", "banner"), "snmp": ("snmp-", "banner"),
|
|
50
|
+
"domain": ("dns-", "banner"), "dns": ("dns-", "banner"),
|
|
51
|
+
"mongodb": ("mongodb-", "banner"),
|
|
52
|
+
"microsoft-ds": ("smb-", "banner"), "smb": ("smb-", "banner"),
|
|
53
|
+
"netbios-ssn": ("smb-", "banner"), "tls": ("ssl-", "banner"),
|
|
54
|
+
}
|
|
55
|
+
PORT_FAMILY = {80: "http", 443: "https", 8000: "http", 8080: "http", 8443: "https", 5000: "http", 9000: "http"}
|
|
56
|
+
DEFAULTS = {"banner", "default", "http-title", "http-server-header", "http-robots.txt", "http-methods",
|
|
57
|
+
"http-git", "http-favicon", "ssl-cert", "ssl-enum-ciphers", "ssh-hostkey", "ssh2-enum-algos",
|
|
58
|
+
"ftp-anon", "smtp-commands", "redis-info"}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def c(code, s):
|
|
62
|
+
if os.environ.get("NO_COLOR") or not (os.environ.get("FORCE_COLOR") or sys.stdout.isatty()):
|
|
63
|
+
return s
|
|
64
|
+
return f"\033[{code}m{s}\033[0m"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def norm(s):
|
|
68
|
+
return re.sub(r"[|_\\`'\"]+", " ", re.sub(r"\s+", " ", (s or "").lower())).strip()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def valid_target(value):
|
|
72
|
+
"""Reject Nmap option injection while allowing hostnames, IPs, and CIDRs."""
|
|
73
|
+
if not value or value.startswith("-") or not re.fullmatch(r"[A-Za-z0-9_.:/%-]+", value):
|
|
74
|
+
return False
|
|
75
|
+
try:
|
|
76
|
+
ipaddress.ip_network(value, strict=False)
|
|
77
|
+
return True
|
|
78
|
+
except ValueError:
|
|
79
|
+
return bool(re.fullmatch(r"(?=.{1,253}$)(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(?:\.(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?))*\.?", value))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def valid_script_id(value):
|
|
83
|
+
return not value.startswith("-") and bool(re.fullmatch(r"[A-Za-z0-9_.-]+", value)) and value not in (".", "..")
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def build_catalog(scripts_dir=None, library=None):
|
|
87
|
+
"""Build catalog rows in memory; write data/nse-catalog.jsonl only for a legacy dir."""
|
|
88
|
+
scripts_dir = Path(scripts_dir or SCRIPTS_DIR)
|
|
89
|
+
rows = [script_metadata(path, "nmap-official", library or scripts_dir)
|
|
90
|
+
for path in sorted(scripts_dir.rglob("*.nse"))]
|
|
91
|
+
if not rows:
|
|
92
|
+
raise SystemExit(f"aucun .nse sous {scripts_dir} : definir NSE_SCRIPTS")
|
|
93
|
+
if library is None:
|
|
94
|
+
CAT.parent.mkdir(parents=True, exist_ok=True)
|
|
95
|
+
CAT.write_text("".join(json.dumps(row, ensure_ascii=False, sort_keys=True) + "\n"
|
|
96
|
+
for row in rows), encoding="utf-8")
|
|
97
|
+
return rows
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def load_catalog(datadir=None):
|
|
101
|
+
library = resolve_library(datadir)
|
|
102
|
+
if library:
|
|
103
|
+
return load_library_catalog(library / "catalog.jsonl", library), library
|
|
104
|
+
if CAT.is_file():
|
|
105
|
+
return load_library_catalog(CAT), None
|
|
106
|
+
if SCRIPTS_DIR.is_dir():
|
|
107
|
+
return build_catalog(), None
|
|
108
|
+
raise SystemExit("bibliothèque NSE introuvable: utiliser --datadir ou definir NSE_SCRIPTS")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def host_states(source):
|
|
112
|
+
"""-> [{host, ports:[{port, service_name, known, uncertain, done}]} dans le format vu au train."""
|
|
113
|
+
raw = source.read() if hasattr(source, "read") else Path(source).read_bytes()
|
|
114
|
+
if len(raw) > 20 * 1024 * 1024 or b"<!ENTITY" in raw.upper():
|
|
115
|
+
raise ValueError("XML trop volumineux ou contenant des entités")
|
|
116
|
+
root = ET.fromstring(raw)
|
|
117
|
+
out = []
|
|
118
|
+
for host in root.findall("host"):
|
|
119
|
+
addr = next((a.get("addr") for a in host.findall("address") if a.get("addrtype") == "ipv4"),
|
|
120
|
+
host.get("name") or "?")
|
|
121
|
+
ports = []
|
|
122
|
+
for pt in host.findall("ports/port"):
|
|
123
|
+
st = pt.find("state")
|
|
124
|
+
if st is None or st.get("state") != "open":
|
|
125
|
+
continue
|
|
126
|
+
port = int(pt.get("portid"))
|
|
127
|
+
known, uncertain = [f"port {port}/tcp open"], []
|
|
128
|
+
svc = pt.find("service")
|
|
129
|
+
name = (svc.get("name") if svc is not None else "") or ""
|
|
130
|
+
prod = svc.get("product") if svc is not None else None
|
|
131
|
+
conf = int((svc.get("conf") if svc is not None else 0) or 0)
|
|
132
|
+
if prod and conf >= 7:
|
|
133
|
+
known.append(f"service {port}: {prod} {svc.get('version', '')}".strip())
|
|
134
|
+
elif prod:
|
|
135
|
+
known.append(f"service {port}: {prod}")
|
|
136
|
+
elif name:
|
|
137
|
+
uncertain.append(f"service {port}: {name}")
|
|
138
|
+
done, outputs = set(), []
|
|
139
|
+
for script in pt.findall("script"):
|
|
140
|
+
done.add(script.get("id"))
|
|
141
|
+
output = script.find("output")
|
|
142
|
+
text = (output.text if output is not None and output.text else None) or script.get("output") or ""
|
|
143
|
+
outputs.extend(norm(x) for x in re.split(r"[\r\n]+", text) if len(norm(x)) >= 10)
|
|
144
|
+
known.extend(item for item in outputs if not any(item in known_item or known_item in item
|
|
145
|
+
for known_item in known))
|
|
146
|
+
ports.append({"port": port, "protocol": pt.get("protocol") or "tcp",
|
|
147
|
+
"service": name, "product": prod or "",
|
|
148
|
+
"version": (svc.get("version", "") if svc is not None else "") or "",
|
|
149
|
+
"tunnel": (svc.get("tunnel", "") if svc is not None else "") or "",
|
|
150
|
+
"servicefp": (svc.get("servicefp", "") if svc is not None else "") or "",
|
|
151
|
+
"known": known[:12], "uncertain": uncertain[:6],
|
|
152
|
+
"evidence": known + uncertain, "done": done})
|
|
153
|
+
out.append({"host": addr, "ports": ports,
|
|
154
|
+
"host_scripts": [{"id": s.get("id"), "output": s.get("output") or ""}
|
|
155
|
+
for s in host.findall("hostscript/script")]})
|
|
156
|
+
if len(out) > 1024:
|
|
157
|
+
raise ValueError("XML dépasse la limite de 1024 hôtes")
|
|
158
|
+
return out
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _row_path(row, library):
|
|
162
|
+
path = Path(row.get("path", ""))
|
|
163
|
+
if not path.is_absolute():
|
|
164
|
+
if library:
|
|
165
|
+
path = Path(library) / path
|
|
166
|
+
elif len(path.parts) > 1 and path.parts[0] == "scripts":
|
|
167
|
+
path = SCRIPTS_DIR / path.name
|
|
168
|
+
else:
|
|
169
|
+
path = SCRIPTS_DIR / path
|
|
170
|
+
return path
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _manual_row(script_id, catalog, library):
|
|
174
|
+
for row in catalog:
|
|
175
|
+
if row["script_id"] == script_id:
|
|
176
|
+
return row
|
|
177
|
+
for path in PERSONAL_DIR.rglob(f"{script_id}.nse"):
|
|
178
|
+
text = path.read_text(encoding="utf-8", errors="replace")
|
|
179
|
+
row = script_metadata(path, "personal", None, "unlicensed")
|
|
180
|
+
row["description"] = row["description"] or script_id
|
|
181
|
+
row["path"] = str(path)
|
|
182
|
+
return row
|
|
183
|
+
return None
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def _auto_allowed(row, allow_risky, all_scripts=False, personal_auto=False, allow_external=False):
|
|
187
|
+
source = row.get("source", "nmap-official")
|
|
188
|
+
categories = set(row.get("categories", []))
|
|
189
|
+
if source == "personal":
|
|
190
|
+
return personal_auto and bool(row.get("auto_allowed")) and (
|
|
191
|
+
allow_external or EXTERNAL_CATEGORY not in categories)
|
|
192
|
+
if source != "nmap-official" and not all_scripts:
|
|
193
|
+
return False
|
|
194
|
+
if EXTERNAL_CATEGORY in categories:
|
|
195
|
+
return allow_external
|
|
196
|
+
if categories & RISKY_CATEGORIES:
|
|
197
|
+
return allow_risky
|
|
198
|
+
if source == "nmap-official":
|
|
199
|
+
if "auto_allowed" in row:
|
|
200
|
+
return bool(row["auto_allowed"])
|
|
201
|
+
return bool(categories & DEFAULT_CATEGORIES) or not categories
|
|
202
|
+
return bool(categories & DEFAULT_CATEGORIES)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def pick_candidates(svc, port, done, catalog, manual, cap, allow_risky=False,
|
|
206
|
+
all_scripts=False, families=None, personal_auto=False,
|
|
207
|
+
allow_external=False):
|
|
208
|
+
if manual:
|
|
209
|
+
ids = list(dict.fromkeys(s.strip() for s in manual.split(",") if s.strip()))
|
|
210
|
+
invalid = sorted(sid for sid in ids if not valid_script_id(sid))
|
|
211
|
+
if invalid:
|
|
212
|
+
raise ValueError(f"identifiant NSE invalide: {invalid[0]!r}")
|
|
213
|
+
found = []
|
|
214
|
+
for sid in ids:
|
|
215
|
+
row = _manual_row(sid, catalog, None)
|
|
216
|
+
if row:
|
|
217
|
+
found.append(row)
|
|
218
|
+
return found[:cap]
|
|
219
|
+
if families:
|
|
220
|
+
prefixes = []
|
|
221
|
+
wanted = []
|
|
222
|
+
for item in families:
|
|
223
|
+
name = item["name"] if isinstance(item, dict) else item
|
|
224
|
+
wanted.append(name)
|
|
225
|
+
prefixes.extend(FAMILY.get(name, (name,)))
|
|
226
|
+
prefs = tuple(dict.fromkeys(prefix for prefix in prefixes if prefix))
|
|
227
|
+
wanted = set(wanted)
|
|
228
|
+
else:
|
|
229
|
+
wanted = set()
|
|
230
|
+
prefs = FAMILY.get(svc)
|
|
231
|
+
if not prefs and port in PORT_FAMILY:
|
|
232
|
+
prefs = FAMILY[PORT_FAMILY[port]]
|
|
233
|
+
prefs = prefs or tuple(p for p in (svc.split("-")[0], "banner") if p)
|
|
234
|
+
def matches(row):
|
|
235
|
+
if any(row["script_id"].startswith(prefix) or prefix == row["script_id"]
|
|
236
|
+
for prefix in prefs if prefix):
|
|
237
|
+
return True
|
|
238
|
+
return (row.get("source") == "personal" and personal_auto
|
|
239
|
+
and bool(set(row.get("families", [])) & wanted))
|
|
240
|
+
pool = [row for row in catalog if row["script_id"] not in done
|
|
241
|
+
and matches(row)
|
|
242
|
+
and _auto_allowed(row, allow_risky, all_scripts, personal_auto, allow_external)]
|
|
243
|
+
ordered = sorted(pool, key=lambda row: (
|
|
244
|
+
row["script_id"] not in DEFAULTS,
|
|
245
|
+
0 if row.get("source") == "personal" else 1 if row.get("source", "nmap-official") == "nmap-official" else 2,
|
|
246
|
+
row["script_id"]))
|
|
247
|
+
return ordered[:cap]
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def resolve_nmap():
|
|
251
|
+
native = shutil.which("nmap")
|
|
252
|
+
if native:
|
|
253
|
+
return [native], False
|
|
254
|
+
if WINDOWS and shutil.which("wsl"):
|
|
255
|
+
return ["wsl", "nmap"], True
|
|
256
|
+
raise RuntimeError("nmap introuvable : installez Nmap, ou WSL avec Nmap sous Windows")
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
def nmap_path(path, use_wsl=None):
|
|
260
|
+
if use_wsl is None:
|
|
261
|
+
use_wsl = WINDOWS
|
|
262
|
+
path = Path(path).resolve()
|
|
263
|
+
if not use_wsl:
|
|
264
|
+
return str(path)
|
|
265
|
+
value = path.as_posix()
|
|
266
|
+
return "/mnt/" + value[0].lower() + value[2:]
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def nmap_command(base, library, use_wsl):
|
|
270
|
+
if library and use_wsl:
|
|
271
|
+
return ["wsl", "env", f"NMAPDIR={nmap_path(library, True)}", "nmap"] + base
|
|
272
|
+
if library:
|
|
273
|
+
return ["nmap"] + base
|
|
274
|
+
return (["wsl", "nmap"] if use_wsl else ["nmap"]) + base
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def nmap_env(library, use_wsl):
|
|
278
|
+
if not library or use_wsl:
|
|
279
|
+
return None
|
|
280
|
+
env = os.environ.copy()
|
|
281
|
+
env["NMAPDIR"] = str(Path(library).resolve())
|
|
282
|
+
return env
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def run_nmap(argv, timeout, env=None, capture=False, stderr=None):
|
|
286
|
+
return subprocess.run(argv, timeout=timeout, env=env, stdin=subprocess.DEVNULL,
|
|
287
|
+
cwd=tempfile.gettempdir(), text=capture,
|
|
288
|
+
stdout=subprocess.PIPE if capture else stderr,
|
|
289
|
+
stderr=subprocess.PIPE if capture else stderr)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def xml_from_stdin():
|
|
293
|
+
data = sys.stdin.buffer.read()
|
|
294
|
+
if not data.strip():
|
|
295
|
+
raise ValueError("stdin vide : fournir un XML Nmap (-oX -)")
|
|
296
|
+
return io.BytesIO(data)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def script_argument(row, library, use_wsl):
|
|
300
|
+
path = _row_path(row, library)
|
|
301
|
+
if row.get("source", "nmap-official") == "nmap-official":
|
|
302
|
+
return row["script_id"]
|
|
303
|
+
return nmap_path(path, use_wsl)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def verify_script(row, library, personal_root=None):
|
|
307
|
+
path = _row_path(row, library)
|
|
308
|
+
if not path.is_file():
|
|
309
|
+
raise ValueError(f"script introuvable: {path}")
|
|
310
|
+
if hash_file(path) != row.get("script_sha256"):
|
|
311
|
+
raise ValueError(f"empreinte du script modifiée: {path}")
|
|
312
|
+
if row.get("source") == "personal":
|
|
313
|
+
root = Path(personal_root).expanduser().resolve() if personal_root else PERSONAL_DIR.resolve()
|
|
314
|
+
else:
|
|
315
|
+
root = Path(library).resolve() if library else PERSONAL_DIR.resolve()
|
|
316
|
+
if root not in path.resolve().parents and path.resolve() != root:
|
|
317
|
+
raise ValueError(f"script hors bibliothèque: {path}")
|
|
318
|
+
return path
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def make_parser():
|
|
322
|
+
parser = argparse.ArgumentParser(
|
|
323
|
+
prog="phronesis",
|
|
324
|
+
description="Choisit un script NSE utile, ou STOP, à partir d'un XML Nmap.",
|
|
325
|
+
epilog="Sous-commandes: suggest, index, update-db.")
|
|
326
|
+
parser.add_argument("target", nargs="?", help="hôte/IP à scanner si aucun XML n'est fourni")
|
|
327
|
+
parser.add_argument("-p", "--ports", default="")
|
|
328
|
+
parser.add_argument("--xml", help="XML Nmap existant, ou - pour stdin")
|
|
329
|
+
parser.add_argument("--scripts", default="", help="candidats forcés, ex: http-title,ssl-cert")
|
|
330
|
+
parser.add_argument("--top", type=int, default=None,
|
|
331
|
+
help="nombre maximal de candidats par port (défaut: 8)")
|
|
332
|
+
parser.add_argument("--datadir", help="racine de la bibliothèque NSE (scripts/ et nselib/)")
|
|
333
|
+
parser.add_argument("--personal-dir", help="dossier des scripts NSE personnels")
|
|
334
|
+
parser.add_argument("--personal-overrides", action="store_true",
|
|
335
|
+
help="un script perso remplace un script officiel de même identifiant")
|
|
336
|
+
parser.add_argument("--allow-undocumented-personal", action="store_true")
|
|
337
|
+
parser.add_argument("--model-dir", help="dossier local du modèle Phronesis Safetensors")
|
|
338
|
+
parser.add_argument("--device", default=None)
|
|
339
|
+
parser.add_argument("--allow-risky", action="store_true",
|
|
340
|
+
help="autorise les scripts officiels intrusive/brute/dos/exploit")
|
|
341
|
+
parser.add_argument("--all-scripts", action="store_true",
|
|
342
|
+
help="inclut les scripts communautaires sûrs dans le pool automatique")
|
|
343
|
+
parser.add_argument("--allow-external", action="store_true",
|
|
344
|
+
help="autorise les scripts qui contactent un service tiers")
|
|
345
|
+
parser.add_argument("--all-candidates", action="store_true",
|
|
346
|
+
help="note tout le pool filtré au lieu de le plafonner")
|
|
347
|
+
parser.add_argument("--templates", action="append", default=[],
|
|
348
|
+
help="fichier ou dossier de templates YAML/JSON (répétable)")
|
|
349
|
+
parser.add_argument("--no-templates", action="store_true")
|
|
350
|
+
parser.add_argument("--max-candidates", type=int, default=None,
|
|
351
|
+
help="candidats notés par port en mode suggest (défaut: 24)")
|
|
352
|
+
parser.add_argument("--top-k", type=int, default=None,
|
|
353
|
+
help="suggestions affichées par port (défaut: 8)")
|
|
354
|
+
parser.add_argument("--min-prob", type=float, default=None)
|
|
355
|
+
parser.add_argument("--stop-threshold", type=float, default=None)
|
|
356
|
+
parser.add_argument("--method", choices=("sequence", "generative"), default=None)
|
|
357
|
+
parser.add_argument("--profile", help="profil YAML/JSON de suggestions")
|
|
358
|
+
parser.add_argument("--explain", action="store_true")
|
|
359
|
+
parser.add_argument("--timeout", type=float, default=300.0, help="timeout Nmap en secondes")
|
|
360
|
+
parser.add_argument("--format", choices=("lines", "table", "jsonl", "commands"), default=None)
|
|
361
|
+
parser.add_argument("-json", "--json", action="store_true", help="sortie JSONL")
|
|
362
|
+
parser.add_argument("--table", action="store_true", help="sortie tableau")
|
|
363
|
+
parser.add_argument("--commands", action="store_true", help="sortie commandes seulement")
|
|
364
|
+
parser.add_argument("-silent", "--silent", action="store_true")
|
|
365
|
+
parser.add_argument("-nc", "--no-color", action="store_true")
|
|
366
|
+
parser.add_argument("-v", "--verbose", action="store_true")
|
|
367
|
+
parser.add_argument("-o", "--output", help="écrit les résultats dans un fichier")
|
|
368
|
+
parser.add_argument("-version", "--version", action="store_true")
|
|
369
|
+
parser.add_argument("--catalog", action="store_true", help="affiche le catalogue et quitte")
|
|
370
|
+
parser.add_argument("--run", action="store_true", help="exécute les scripts proposés")
|
|
371
|
+
return parser
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def command_for(host, ps, selected, library):
|
|
375
|
+
native, use_wsl = resolve_nmap()
|
|
376
|
+
script_arg = script_argument(selected, library, use_wsl)
|
|
377
|
+
base = ["-Pn", "-sV"]
|
|
378
|
+
if ps.get("protocol") == "udp":
|
|
379
|
+
base.append("-sU")
|
|
380
|
+
base += ["-p", str(ps["port"]), "--script", script_arg, host]
|
|
381
|
+
return nmap_command(base, library, use_wsl)
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def index_main(argv):
|
|
385
|
+
parser = argparse.ArgumentParser(prog="phronesis index")
|
|
386
|
+
parser.add_argument("--personal", required=True, help="dossier des scripts NSE personnels")
|
|
387
|
+
parser.add_argument("--output", required=True, help="catalogue JSONL à écrire")
|
|
388
|
+
parser.add_argument("--include-undocumented", action="store_true")
|
|
389
|
+
args = parser.parse_args(argv)
|
|
390
|
+
try:
|
|
391
|
+
result = index_personal(args.personal, args.output, args.include_undocumented)
|
|
392
|
+
except (ValueError, OSError, json.JSONDecodeError) as exc:
|
|
393
|
+
print(f"[ERR] {exc}", file=sys.stderr)
|
|
394
|
+
return 1
|
|
395
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
396
|
+
return 0
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def main(argv=None):
|
|
400
|
+
argv = list(sys.argv[1:] if argv is None else argv)
|
|
401
|
+
if argv and argv[0] == "doctor":
|
|
402
|
+
from nseft.doctor import main as doctor_main
|
|
403
|
+
return doctor_main(argv[1:])
|
|
404
|
+
suggest_mode = bool(argv and argv[0] == "suggest")
|
|
405
|
+
if suggest_mode:
|
|
406
|
+
argv = argv[1:]
|
|
407
|
+
if argv and argv[0] == "update-db":
|
|
408
|
+
from nseft.update_db import main as update_main
|
|
409
|
+
return update_main(argv[1:])
|
|
410
|
+
if argv and argv[0] == "index":
|
|
411
|
+
return index_main(argv[1:])
|
|
412
|
+
parser = make_parser()
|
|
413
|
+
args = parser.parse_args(argv)
|
|
414
|
+
args.suggest_mode = suggest_mode
|
|
415
|
+
profile = {}
|
|
416
|
+
if args.profile:
|
|
417
|
+
try:
|
|
418
|
+
profile = load_profile(args.profile)
|
|
419
|
+
except (ValueError, OSError, json.JSONDecodeError) as exc:
|
|
420
|
+
parser.error(f"profil illisible: {exc}")
|
|
421
|
+
base = Path(args.profile).resolve().parent
|
|
422
|
+
profile["templates"] = [str(path if Path(path).is_absolute() else base / path)
|
|
423
|
+
for path in profile.get("templates", [])]
|
|
424
|
+
for key, default in (("top", 8), ("max_candidates", 24), ("top_k", 8),
|
|
425
|
+
("min_prob", 0.0), ("stop_threshold", 0.5), ("format", "lines")):
|
|
426
|
+
if getattr(args, key) is None:
|
|
427
|
+
setattr(args, key, profile.get(key, default))
|
|
428
|
+
for key in ("all_scripts", "allow_risky", "allow_external"):
|
|
429
|
+
setattr(args, key, getattr(args, key) or profile.get(key, False))
|
|
430
|
+
for key in ("datadir", "personal_dir", "model_dir", "device", "method"):
|
|
431
|
+
if getattr(args, key) is None and key in profile:
|
|
432
|
+
setattr(args, key, profile[key])
|
|
433
|
+
if profile.get("templates"):
|
|
434
|
+
args.templates = profile["templates"] + args.templates
|
|
435
|
+
if args.version:
|
|
436
|
+
try:
|
|
437
|
+
from importlib.metadata import version
|
|
438
|
+
print(f"phronesis {version('phronesis-nse')}")
|
|
439
|
+
except Exception:
|
|
440
|
+
print("phronesis 0.3.0")
|
|
441
|
+
return 0
|
|
442
|
+
if args.top < 1:
|
|
443
|
+
parser.error("--top doit être supérieur ou égal à 1")
|
|
444
|
+
if args.target and not valid_target(args.target):
|
|
445
|
+
parser.error("cible invalide ; utiliser un nom d'hôte, une adresse IP ou un CIDR")
|
|
446
|
+
logger = Logger(args.silent, args.no_color, args.verbose)
|
|
447
|
+
if args.json:
|
|
448
|
+
args.format = "jsonl"
|
|
449
|
+
if args.table:
|
|
450
|
+
args.format = "table"
|
|
451
|
+
if args.commands:
|
|
452
|
+
args.format = "commands"
|
|
453
|
+
if not args.catalog and not args.target and not args.xml and sys.stdin.isatty():
|
|
454
|
+
parser.print_help()
|
|
455
|
+
return 0
|
|
456
|
+
|
|
457
|
+
try:
|
|
458
|
+
catalog, library = load_catalog(args.datadir)
|
|
459
|
+
except (ValueError, SystemExit) as exc:
|
|
460
|
+
logger.error(str(exc))
|
|
461
|
+
return 1
|
|
462
|
+
personal_auto = False
|
|
463
|
+
if args.personal_dir:
|
|
464
|
+
try:
|
|
465
|
+
personal = personal_rows(args.personal_dir, args.allow_undocumented_personal)
|
|
466
|
+
catalog, diagnostics = merge_catalogs(catalog, personal, args.personal_overrides)
|
|
467
|
+
personal_auto = True
|
|
468
|
+
logger.info(f"scripts personnels: {len(personal)} indexés, "
|
|
469
|
+
f"{len(diagnostics)} doublon(s) ignoré(s)")
|
|
470
|
+
except (ValueError, OSError, json.JSONDecodeError) as exc:
|
|
471
|
+
logger.error(f"scripts personnels illisibles: {exc}")
|
|
472
|
+
return 1
|
|
473
|
+
templates = []
|
|
474
|
+
if args.templates and not args.no_templates:
|
|
475
|
+
try:
|
|
476
|
+
templates = load_templates(args.templates)
|
|
477
|
+
logger.info(f"templates chargés: {len(templates)}")
|
|
478
|
+
except (ValueError, OSError, json.JSONDecodeError) as exc:
|
|
479
|
+
logger.error(f"templates illisibles: {exc}")
|
|
480
|
+
return 1
|
|
481
|
+
if args.catalog:
|
|
482
|
+
for row in catalog:
|
|
483
|
+
print(result_json(row) if args.format == "jsonl" else row["script_id"])
|
|
484
|
+
return 0
|
|
485
|
+
|
|
486
|
+
try:
|
|
487
|
+
if args.xml == "-":
|
|
488
|
+
source = xml_from_stdin()
|
|
489
|
+
elif args.xml:
|
|
490
|
+
source = Path(args.xml)
|
|
491
|
+
elif args.target:
|
|
492
|
+
native, use_wsl = resolve_nmap()
|
|
493
|
+
base = ["-Pn", "-sV", "-n"]
|
|
494
|
+
if args.ports:
|
|
495
|
+
base += ["-p", args.ports]
|
|
496
|
+
base += ["-oX", "-", args.target]
|
|
497
|
+
command = nmap_command(base, library, use_wsl)
|
|
498
|
+
logger.info("scan baseline: " + shell_command(command))
|
|
499
|
+
result = run_nmap(command, args.timeout, nmap_env(library, use_wsl), capture=True)
|
|
500
|
+
if result.returncode:
|
|
501
|
+
logger.error(result.stderr.strip() or "nmap a échoué")
|
|
502
|
+
return 1
|
|
503
|
+
source = io.BytesIO(result.stdout.encode())
|
|
504
|
+
elif not sys.stdin.isatty():
|
|
505
|
+
source = xml_from_stdin()
|
|
506
|
+
else:
|
|
507
|
+
parser.print_help()
|
|
508
|
+
return 0
|
|
509
|
+
states = host_states(source)
|
|
510
|
+
except (ValueError, OSError, ET.ParseError, subprocess.TimeoutExpired, RuntimeError) as exc:
|
|
511
|
+
logger.error(str(exc))
|
|
512
|
+
return 2
|
|
513
|
+
|
|
514
|
+
safe_count = sum(1 for row in catalog
|
|
515
|
+
if _auto_allowed(row, False, args.all_scripts, personal_auto, args.allow_external))
|
|
516
|
+
pool_name = "all" if args.all_scripts else "safe"
|
|
517
|
+
logger.info(f"bibliothèque: {len(catalog)} scripts, pool {pool_name}: {safe_count}")
|
|
518
|
+
|
|
519
|
+
pending = []
|
|
520
|
+
for host in states:
|
|
521
|
+
for ps in host["ports"]:
|
|
522
|
+
families = infer_families(ps)
|
|
523
|
+
cands = pick_candidates(ps["service"], ps["port"], ps["done"], catalog,
|
|
524
|
+
args.scripts,
|
|
525
|
+
10000 if args.all_candidates else
|
|
526
|
+
(args.max_candidates if args.suggest_mode else args.top),
|
|
527
|
+
args.allow_risky,
|
|
528
|
+
args.all_scripts, families=families,
|
|
529
|
+
personal_auto=personal_auto,
|
|
530
|
+
allow_external=args.allow_external)
|
|
531
|
+
boosts, reasons, forced_stop, matched_templates = {}, {}, False, []
|
|
532
|
+
if templates:
|
|
533
|
+
template_state = {"port": ps["port"], "service": ps["service"] or "unknown"}
|
|
534
|
+
template_evidence = {
|
|
535
|
+
"port": ps["port"], "protocol": ps.get("protocol", "tcp"),
|
|
536
|
+
"service": ps["service"] or "", "product": ps.get("product", ""),
|
|
537
|
+
"version": ps.get("version", ""), "tunnel": ps.get("tunnel", ""),
|
|
538
|
+
"evidence": ps.get("evidence", []),
|
|
539
|
+
}
|
|
540
|
+
cands, boosts, reasons, forced_stop, matched_templates = apply_templates(
|
|
541
|
+
templates, template_state, template_evidence, ps["done"], cands, catalog,
|
|
542
|
+
lambda row: _auto_allowed(row, args.allow_risky, args.all_scripts,
|
|
543
|
+
personal_auto, args.allow_external))
|
|
544
|
+
pending.append({"host": host["host"], "ps": ps, "candidates": cands,
|
|
545
|
+
"families": families, "boosts": boosts, "reasons": reasons,
|
|
546
|
+
"forced_stop": forced_stop, "templates": matched_templates})
|
|
547
|
+
if not pending:
|
|
548
|
+
logger.warn("aucun port ouvert dans le XML")
|
|
549
|
+
return 0
|
|
550
|
+
if not any(item["candidates"] for item in pending):
|
|
551
|
+
logger.warn("aucun candidat pour les ports analysés")
|
|
552
|
+
return 0
|
|
553
|
+
|
|
554
|
+
try:
|
|
555
|
+
import torch
|
|
556
|
+
from nseft.phronesis import choose_action, load_model
|
|
557
|
+
except ImportError as exc:
|
|
558
|
+
logger.error(f"environnement d'inférence incomplet ({exc})")
|
|
559
|
+
return 1
|
|
560
|
+
device = args.device or ("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
561
|
+
model_dir = Path(args.model_dir).resolve() if args.model_dir else MODEL_DIR
|
|
562
|
+
if model_dir is None and not args.model_dir:
|
|
563
|
+
try:
|
|
564
|
+
model_dir = resolve_model_dir(download=True, repo_root=ROOT)
|
|
565
|
+
except WeightsError as exc:
|
|
566
|
+
logger.error(f"modèle Phronesis : {exc}")
|
|
567
|
+
return 1
|
|
568
|
+
if model_dir is None or not (model_dir / "model.safetensors").is_file():
|
|
569
|
+
logger.error("modèle Phronesis introuvable ; utiliser --model-dir")
|
|
570
|
+
return 1
|
|
571
|
+
logger.info(f"chargement du modèle depuis {model_dir} sur {device}")
|
|
572
|
+
try:
|
|
573
|
+
model, tokenizer = load_model(model_dir, device)
|
|
574
|
+
except Exception as exc:
|
|
575
|
+
logger.error(f"chargement du modèle impossible: {exc}")
|
|
576
|
+
return 1
|
|
577
|
+
|
|
578
|
+
records = []
|
|
579
|
+
commands = []
|
|
580
|
+
failures = 0
|
|
581
|
+
started = time.perf_counter()
|
|
582
|
+
try:
|
|
583
|
+
calibration = load_calibration()
|
|
584
|
+
except ValueError as exc:
|
|
585
|
+
logger.error(f"calibration invalide: {exc}")
|
|
586
|
+
return 1
|
|
587
|
+
method = "sequence" if args.suggest_mode else (args.method or "generative")
|
|
588
|
+
|
|
589
|
+
def candidate_record(row, source_row, pre_probabilities, boosts, reasons):
|
|
590
|
+
return {
|
|
591
|
+
"script_id": row["script_id"],
|
|
592
|
+
"rank": row.get("rank"),
|
|
593
|
+
"score": round(row["score"], 6),
|
|
594
|
+
"probability": round(row["probability"], 6),
|
|
595
|
+
"probability_pre_template": round(pre_probabilities.get(row["script_id"], row["probability"]), 6),
|
|
596
|
+
"probability_kind": "sequence_softmax",
|
|
597
|
+
"temperature": calibration["temperature"],
|
|
598
|
+
"calibrated": calibration["calibrated"],
|
|
599
|
+
"calibration_scope": calibration["calibration_scope"],
|
|
600
|
+
"confidence": "uncalibrated",
|
|
601
|
+
"support": "trained_id" if source_row.get("source", "nmap-official") == "nmap-official" else "zero_shot",
|
|
602
|
+
"source": source_row.get("source", "nmap-official"),
|
|
603
|
+
"documented": bool(source_row.get("documented", True)),
|
|
604
|
+
"auto_allowed": bool(source_row.get("auto_allowed", True)),
|
|
605
|
+
"runnable": True,
|
|
606
|
+
"template_boosts": [{"template": template,
|
|
607
|
+
"delta": round(boosts.get(row["script_id"], 0.0), 6)}
|
|
608
|
+
for template in reasons.get(row["script_id"], [])],
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
for item in pending:
|
|
612
|
+
host = item["host"]
|
|
613
|
+
ps = item["ps"]
|
|
614
|
+
cands = item["candidates"]
|
|
615
|
+
families = item["families"]
|
|
616
|
+
boosts = item["boosts"]
|
|
617
|
+
reasons = item["reasons"]
|
|
618
|
+
if not cands or item["forced_stop"]:
|
|
619
|
+
decision = "STOP" if item["forced_stop"] else "SKIP"
|
|
620
|
+
record = {"host": host, "port": ps["port"], "protocol": ps.get("protocol", "tcp"),
|
|
621
|
+
"service": ps["service"], "decision": decision, "script": None,
|
|
622
|
+
"summary": "aucun candidat" if decision == "SKIP" else "template stop",
|
|
623
|
+
"command": None, "seconds": 0.0, "families": families,
|
|
624
|
+
"templates": item["templates"]}
|
|
625
|
+
records.append(record)
|
|
626
|
+
if args.format == "jsonl":
|
|
627
|
+
print(result_json(record))
|
|
628
|
+
elif args.format == "table":
|
|
629
|
+
pass
|
|
630
|
+
else:
|
|
631
|
+
print(result_line(host, ps["port"], ps["service"], decision, args.no_color,
|
|
632
|
+
ps.get("protocol", "tcp")))
|
|
633
|
+
continue
|
|
634
|
+
state = {"host": host, "port": ps["port"], "service": ps["service"] or "unknown",
|
|
635
|
+
"known_findings": ps["known"], "uncertain_findings": ps["uncertain"]}
|
|
636
|
+
began = time.perf_counter()
|
|
637
|
+
if method == "sequence":
|
|
638
|
+
try:
|
|
639
|
+
ranked = rank_candidates(model, tokenizer, state, cands, calibration["temperature"])
|
|
640
|
+
except Exception as exc:
|
|
641
|
+
logger.error(f"port {ps['port']}/{ps.get('protocol', 'tcp')} : notation impossible ({exc})")
|
|
642
|
+
return 1
|
|
643
|
+
pre_probabilities = {row["script_id"]: row["probability"] for row in ranked}
|
|
644
|
+
for row in ranked:
|
|
645
|
+
row["score"] += boosts.get(row["script_id"], 0.0)
|
|
646
|
+
post = softmax([row["score"] for row in ranked], calibration["temperature"])
|
|
647
|
+
for row, probability in zip(ranked, post):
|
|
648
|
+
row["probability"] = probability
|
|
649
|
+
stop_row = next(row for row in ranked if row["script_id"] == "STOP")
|
|
650
|
+
choices = [row for row in ranked if row["script_id"] != "STOP"]
|
|
651
|
+
choices.sort(key=lambda row: (-row["probability"], row["script_id"]))
|
|
652
|
+
for index, row in enumerate(choices, 1):
|
|
653
|
+
row["rank"] = index
|
|
654
|
+
top = [row for row in choices[:max(0, args.top_k)]
|
|
655
|
+
if row["probability"] >= args.min_prob]
|
|
656
|
+
action = "STOP"
|
|
657
|
+
if top and top[0]["probability"] >= args.min_prob and stop_row["probability"] < args.stop_threshold:
|
|
658
|
+
action = top[0]["script_id"]
|
|
659
|
+
selected = next((row for row in cands if row["script_id"] == action), None)
|
|
660
|
+
command = command_for(host, ps, selected, library) if selected else None
|
|
661
|
+
if command:
|
|
662
|
+
commands.append(command)
|
|
663
|
+
seconds = round(time.perf_counter() - began, 3)
|
|
664
|
+
source_by_id = {row["script_id"]: row for row in cands}
|
|
665
|
+
record = {
|
|
666
|
+
"schema": "phronesis-rank-v1" if args.suggest_mode else "phronesis-select-v1",
|
|
667
|
+
"host": host, "port": ps["port"], "protocol": ps.get("protocol", "tcp"),
|
|
668
|
+
"service": ps["service"], "method": "sequence",
|
|
669
|
+
"families": families, "decision": action,
|
|
670
|
+
"script": action if selected else None,
|
|
671
|
+
"summary": selected["description"] if selected else "",
|
|
672
|
+
"command": shell_command(command) if command else None,
|
|
673
|
+
"seconds": seconds,
|
|
674
|
+
"templates": item["templates"],
|
|
675
|
+
"in_training_range": in_training_range(len(cands), ranked[0]["prompt_tokens"]),
|
|
676
|
+
"candidates": [candidate_record(row, source_by_id[row["script_id"]],
|
|
677
|
+
pre_probabilities, boosts, reasons)
|
|
678
|
+
for row in top],
|
|
679
|
+
"stop": {"score": round(stop_row["score"], 6),
|
|
680
|
+
"probability": round(stop_row["probability"], 6), "boost": 0.0},
|
|
681
|
+
}
|
|
682
|
+
# Template attribution is carried separately to keep the schema simple.
|
|
683
|
+
for row in record["candidates"]:
|
|
684
|
+
row["template_hits"] = reasons.get(row["script_id"], [])
|
|
685
|
+
records.append(record)
|
|
686
|
+
if args.format == "jsonl":
|
|
687
|
+
print(result_json(record))
|
|
688
|
+
elif args.format == "commands":
|
|
689
|
+
if command:
|
|
690
|
+
print(shell_command(command))
|
|
691
|
+
elif args.format == "table":
|
|
692
|
+
pass
|
|
693
|
+
else:
|
|
694
|
+
if args.suggest_mode:
|
|
695
|
+
for row in top:
|
|
696
|
+
suffix = ""
|
|
697
|
+
if args.explain and reasons.get(row["script_id"]):
|
|
698
|
+
suffix = " templates=" + ",".join(reasons[row["script_id"]])
|
|
699
|
+
print(suggest_line(host, ps["port"], ps["service"], row["rank"],
|
|
700
|
+
row["script_id"], row["probability"], args.no_color,
|
|
701
|
+
ps.get("protocol", "tcp")) + suffix)
|
|
702
|
+
elif action != "STOP":
|
|
703
|
+
print(result_line(host, ps["port"], ps["service"], action, args.no_color,
|
|
704
|
+
ps.get("protocol", "tcp")))
|
|
705
|
+
if action == "STOP":
|
|
706
|
+
print(result_line(host, ps["port"], ps["service"], "STOP", args.no_color,
|
|
707
|
+
ps.get("protocol", "tcp")))
|
|
708
|
+
if command:
|
|
709
|
+
logger.info("commande: " + shell_command(command))
|
|
710
|
+
else:
|
|
711
|
+
try:
|
|
712
|
+
action = choose_action(model, tokenizer, state, cands)
|
|
713
|
+
except ValueError as exc:
|
|
714
|
+
logger.error(f"port {ps['port']}/{ps.get('protocol', 'tcp')} : sortie Phronesis invalide ({exc})")
|
|
715
|
+
records.append({"host": host, "port": ps["port"],
|
|
716
|
+
"protocol": ps.get("protocol", "tcp"),
|
|
717
|
+
"service": ps["service"], "decision": "INVALID", "script": None,
|
|
718
|
+
"summary": str(exc), "command": None,
|
|
719
|
+
"seconds": round(time.perf_counter() - began, 3),
|
|
720
|
+
"families": families})
|
|
721
|
+
failures += 1
|
|
722
|
+
continue
|
|
723
|
+
except Exception as exc:
|
|
724
|
+
logger.error(f"port {ps['port']}/{ps.get('protocol', 'tcp')} : inférence impossible ({exc})")
|
|
725
|
+
return 1
|
|
726
|
+
selected = next((row for row in cands if row["script_id"] == action), None)
|
|
727
|
+
command = command_for(host, ps, selected, library) if selected else None
|
|
728
|
+
if command:
|
|
729
|
+
commands.append(command)
|
|
730
|
+
seconds = round(time.perf_counter() - began, 3)
|
|
731
|
+
record = {"host": host, "port": ps["port"], "protocol": ps.get("protocol", "tcp"),
|
|
732
|
+
"service": ps["service"], "decision": action,
|
|
733
|
+
"script": action if selected else None,
|
|
734
|
+
"summary": selected["description"] if selected else "",
|
|
735
|
+
"command": shell_command(command) if command else None, "seconds": seconds,
|
|
736
|
+
"families": families, "templates": item["templates"]}
|
|
737
|
+
records.append(record)
|
|
738
|
+
if args.format == "jsonl":
|
|
739
|
+
print(result_json(record))
|
|
740
|
+
elif args.format == "commands":
|
|
741
|
+
if command:
|
|
742
|
+
print(shell_command(command))
|
|
743
|
+
elif args.format == "table":
|
|
744
|
+
pass
|
|
745
|
+
else:
|
|
746
|
+
print(result_line(host, ps["port"], ps["service"], action, args.no_color,
|
|
747
|
+
ps.get("protocol", "tcp")))
|
|
748
|
+
if command:
|
|
749
|
+
logger.info("commande: " + shell_command(command))
|
|
750
|
+
if args.run and selected:
|
|
751
|
+
try:
|
|
752
|
+
verify_script(selected, library, args.personal_dir)
|
|
753
|
+
except ValueError as exc:
|
|
754
|
+
logger.error(f"exécution refusée: {exc}")
|
|
755
|
+
failures += 1
|
|
756
|
+
continue
|
|
757
|
+
logger.info("exécution: " + shell_command(command))
|
|
758
|
+
native, use_wsl = resolve_nmap()
|
|
759
|
+
result = run_nmap(command, args.timeout, nmap_env(library, use_wsl), stderr=sys.stderr)
|
|
760
|
+
if result.returncode:
|
|
761
|
+
logger.error(f"nmap a échoué sur le port {ps['port']}")
|
|
762
|
+
failures += 1
|
|
763
|
+
|
|
764
|
+
if args.format == "table":
|
|
765
|
+
table(records, args.no_color)
|
|
766
|
+
if commands:
|
|
767
|
+
print()
|
|
768
|
+
for command in commands:
|
|
769
|
+
print(shell_command(command))
|
|
770
|
+
outside = sum(1 for record in records if record.get("in_training_range") is False)
|
|
771
|
+
if outside:
|
|
772
|
+
logger.warn(f"{outside} port(s) hors de la plage d'entraînement "
|
|
773
|
+
f"(> {TRAINED_MAX_CANDIDATES} candidats ou > {TRAINED_MAX_PROMPT_TOKENS} jetons) : "
|
|
774
|
+
"classement peu fiable, à vérifier à la main")
|
|
775
|
+
elapsed = round(time.perf_counter() - started, 3)
|
|
776
|
+
selected_count = sum(1 for record in records if record["decision"] not in ("STOP", "SKIP", "INVALID"))
|
|
777
|
+
stop_count = sum(1 for record in records if record["decision"] == "STOP")
|
|
778
|
+
logger.info(f"stats: {len(states)} hôte(s), {len(pending)} port(s), "
|
|
779
|
+
f"{selected_count} sélection(s), {stop_count} STOP, {failures} erreur(s), {elapsed}s")
|
|
780
|
+
lines = [result_json(record) if args.format == "jsonl"
|
|
781
|
+
else result_line(record["host"], record["port"], record["service"],
|
|
782
|
+
record["decision"], args.no_color, record.get("protocol", "tcp"))
|
|
783
|
+
for record in records]
|
|
784
|
+
if args.format == "commands":
|
|
785
|
+
lines = [shell_command(command) for command in commands]
|
|
786
|
+
if args.output:
|
|
787
|
+
try:
|
|
788
|
+
write_file(args.output, lines)
|
|
789
|
+
except OSError as exc:
|
|
790
|
+
logger.error(f"écriture impossible: {exc}")
|
|
791
|
+
return 1
|
|
792
|
+
return 1 if failures else 0
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
if __name__ == "__main__":
|
|
796
|
+
try:
|
|
797
|
+
raise SystemExit(main())
|
|
798
|
+
except BrokenPipeError:
|
|
799
|
+
raise SystemExit(0)
|
|
800
|
+
except KeyboardInterrupt:
|
|
801
|
+
raise SystemExit(130)
|