模块内容包括:
├─nascan
│ │ NAScan.py # 网络资产信息抓取引擎
│ │
│ ├─lib
│ │ cidr.py
│ │ common.py 其他方法
│ │ icmp.py # ICMP发送类
│ │ log.py # 日志输出
│ │ mongo.py # 数据库连接
│ │ scan.py # 扫描与识别
│ │ start.py # 线程控制
│ │
│ └─plugin
│ masscan.py # 调用Masscan脚本
从主函数NAScan.py开始,函数跑起来如下:
CONFIG_INI = get_config() # 读取配置
CONFIG_INI = get_config() # 读取配置
结果如下(经过处理)
>>> CONFIG_INI
{u'Masscan':u'0|20000|/root/xunfeng/masscan/linux_64/masscan', u'Discern_cms':[[u'phpmyadmin', u'file', u'index', u'pma_username'],[u'phpmyadmin', u'file', u'/phpmyadmin', u'pma_username'],[u'routeros', u'file', u'index', u'<title>RouterOS router configuration page<\\/title>'],[u'destoon', u'file', u'index', u'Powered by DESTOON'],[u'destoon', u'file', u'index', u'DESTOON B2B SYSTEM'],[u'u-mail', u'file', u'index', u'Power(ed)? by[^>]+U-Mail'],[u'winmail', u'file', u'index', u'Winmail Mail Server'],[u'coremail', u'file', u'index', u'Coremail[^>]+<\\/title>'],[u'winmail', u'header', u'Set-Cookie', u'magicwinmail'],[u'winmail', u'file', u'index', u'Powered by Winmail Server'],[u'turbomail', u'file', u'index', u'Powered by TurboMail'],[u'xmail', u'file', u'index', u'\\d{4}-\\d{4}\\s*webmail.idccenter.net'],[u'outlook', u'header', u'X-OWA-Version', u'.*?'],[u'outlook', u'file', u'index', u'Outlook Web (Access|App)\\s*(?=<\\/title>)'],[u'anymacro', u'header', u'Server', u'AnyWebApp'],[u'anymacro', u'file', u'index', u'sec.anymacro.com'],[u'extmail', u'file', u'index', u'powered by.*?Extmail'],[u'lotus', u'file',
u'index', u'IBM Lotus iNotes[^>]+(?=<\\/title>)'],[u'lotus', u'file', u'index', u'iwaredir.nsf'],[u'squirrelmail', u'file', u'index', u'SquirrelMail Project Team'],[u'squirrelmail', u'header', u'Set-Cookie', u'SQMSESSID'],[u'squirrelmail', u'file', u'index', u'SquirrelMail'],[u'eqmail', u'file', u'index', u'Powered by EQMail'],[u'tmailer', u'file', u'index', u'TMailer Collaboration Suite Web Client'],[u'zimbra', u'header', u'Set-Cookie', u'ZM_TEST'],[u'zimbra', u'file', u'index', u'zimbra[^>]+(?=<\\/title>)'],[u'zimbra', u'file', u'index', u'Zimbra,?\\s*Inc. All rights reserved.'],[u'bxemail', u'file', u'index', u'abc@bxemail.com'],[u'horde', u'file', u'index', u'<title>[^>]+?Horde'],[u'horde', u'file', u'index', u'\\/themes\\/graphics\\/horde-power1.png'],[u'atmail', u'file', u'index', u'powered by Atmail'],[u'ilohamail', u'header', u'Set-Cookie', u'IMAIL_TEST_COOKIE'],[u'ilohamail', u'header', u'SESS_KEY', u'.*?'],[u'ilohamail', u'file', u'index', u'powered by[^>]+IlohaMail'],[u'fangmail', u'file', u'index', u'fangmail'],[u'roundcube', u'file', u'index', u'Roundcube'],[u'mailbase', u'header', u'Set-Cookie', u'\\s*(mb_lang|mb_ui_type|mb_cus_type)'],[u'mailbase', u'file', u'index', u'MailBase[^<>]+(?=<\\/title>)'],[u'kxmail', u'file', u'index', u'Powered By\\s?<[^>]+>\\s?KXmail'],[u'tongda', u'file', u'index', u'href="/images/tongda\\.ico"'],[u'trs_wcm', u'file', u'index', u'<title[^>]+>TRS WCM[^<]+</title>'],[u'trs_wcm', u'file', u'index', u'href="/wcm/console/auth/reg_newuser.jsp"'],[u'mymps', u'file', u'index', u'powered by[^&]+Mymps.*?'],[u'mymps', u'file', u'index', u'wcontent="mymps'],[u'mailgard', u'file', u'index', u'mailgard\\swebmail'],[u'discuz', u'file', u'/robots.txt', u'discuz'],[u'discuz', u'file', u'/robots.txt', u'discuz'],[u'phpwind', u'file', u'/robots.txt', u'phpwind'],[u'phpcms', u'file', u'/robots.txt', u'phpcms'],[u'php168', u'file', u'/robots.txt', u'php168'],[u'qibosoft', u'file', u'/robots.txt', u'qibocms'],[u'emlog', u'file', u'/robots.txt', u'robots.txt for emlog'],[u'wecenter', u'file', u'/robots.txt', u'robots.txt for wecenter'],[u'bbsmax', u'file', u'/robots.txt', u'bbsmax'],[u'shopnc', u'file', u'/robots.txt', u'robots.txt for shopnc'],[u'hdwike', u'file', u'/robots.txt', u'robots.txt for hdwiki'],[u'phpdisk', u'file', u'/robots.txt', u'PHPDisk'],[u'dedecms', u'file', u'/data/admin/ver.txt', u'20110812'],[u'dedecms', u'file', u'/data/admin/ver.txt', u'20111111'],[u'dedecms', u'file', u'/data/admin/ver.txt', u'20120709'],[u'dedecms', u'file', u'/data/admin/ver.txt', u'20140814'],[u'dedecms', u'file', u'/data/admin/verifies.txt', u'20081204'],[u'dedecms', u'file', u'/data/admin/verifies.txt', u'20100324'],[u'dedecms', u'file', u'/data/admin/verifies.txt', u'20100514'],[u'dedecms', u'file', u'/data/admin/verifies.txt', u'20110216'],[u'wordpress', u'file', u'/robots.txt', u'wordpress'],[u'wordpress', u'file', u'/license.txt', u'wordpress'],[u'wordpress', u'file', u'/readme.txt', u'wordpress'],[u'wordpress', u'file', u'/help.txt', u'wordpress'],[u'wordpress', u'file', u'/readme.html', u'wordpress'],[u'wordpress', u'file', u'/wp-admin/css/colors-classic.css', u'wordpress'],[u'wordpress', u'file', u'/wp-admin/js/media-upload.dev.js', u'wordpress'],[u'wordpress', u'file', u'/wp-content/plugins/akismet/akismet.js', u'wordpress'],[u'wordpress', u'file', u'/wp-content/themes/classic/rtl.css', u'wordpress'],[u'wordpress', u'file', u'/wp-includes/css/buttons.css', u'wordpress'],[u'z-blog', u'file', u'/license.txt', u'z-bolg'],[u'z-blog', u'file', u'/SCRIPT/common.js', u'z-bolg'],[u'southidc', u'file', u'/Ads/left.js', u'southidc'],[u'southidc', u'file', u'/Css/Style.css', u'southidc'],[u'southidc', u'file', u'/Images/ad.js', u'southidc'],[u'southidc', u'file', u'/Script/Html.js', u'southidc'],[u'siteserver',u'file', u'/robots.txt', u'\\/SiteFiles\\/'],[u'siteserver', u'file', u'/SiteFiles/Inner/Register/script.js', u'stlUserRegister'],[u'enableq', u'file', u'/License/index.php', u'<td>EnableQ'],[u'enableq', u'file', u'/robots.txt', u'robots.txt for EnableQ'],[u'trs_wcm', u'file', u'/wcm/app/login.jsp', u'TRS WCM'],[u'trs_wcm', u'file', u'/wcm/app/login.jsp', u'href="/wcm/console/auth/reg_newuser.jsp"'],[u'mymps', u'file',u'/robots.txt', u'mymps'],[u'igenus', u'file', u'/help/', u'igenus'],[u'mailgard', u'file', u'/help/io_login.html', u'webmail']],
u'Thread':
u'200',
u'Discern_lang':[[u'php', u'header', u'Server', u'php'],[u'php', u'header', u'X-Powered-By', u'php'],[u'php', u'header', u'Set-Cookie', u'PHPSSIONID'],[u'jsp', u'header', u'Set-Cookie', u'JSESSIONID'],[u'asp', u'header', u'Set-Cookie', u'ASPSESSION'],[u'aspx', u'header',u'Set-Cookie', u'ASP.NET_SessionId'],[u'aspx', u'header', u'X-AspNet-Version', u'version'],[u'aspx', u'file', u'index', u'<input[^>]+name=\\"__VIEWSTATE'],[u'aspx', u'file', u'index', u'<a[^>]*?href=(\'|")[^http].*?\\.aspx(\\?|\\1)'],[u'asp', u'file', u'index', u'<a[^>]*?href=(\'|")[^http].*?\\.asp(\\?|\\1)'],[u'php', u'file', u'index', u'<a[^>]*?href=(\'|")[^http].*?\\.php(\\?|\\1)'],[u'jsp', u'file', u'index', u'<a[^>]*?href=(\'|")[^http].*?\\.jsp(\\?|\\1)']],
u'Discern_con':[[u'jboss', u'header', u'X-Powered-By', u'jboss'],[u'jboss', u'file', u'jboss.css', u'youcandoit.jpg'],[u'jboss', u'file', u'is_test', u'JBossWeb'],[u'axis', u'file', u'axis2', u'axis2-web/images/axis_l.jpg'],[u'weblogic', u'file', u'is_test', u'Hypertext Transfer Protocol'],[u'weblogic', u'file', u'console/css/login.css', u'Login_GC_LoginPage_Bg.gif'],[u'glassfish', u'file', u'resource/js/cj.js', u'glassfish.dev.java.net'],[u'glassfish', u'header', u'server', u'GlassFish'],[u'jenkins', u'header', u'X-Jenkins', u'.*?'],[u'jenkins', u'file', u'index', u'\\[Jenkins\\]'],[u'resin', u'header', u'server', u'resin'],[u'tomcat', u'file', u'is_test', u'Apache Tomcat'],[u'apache', u'header', u'server', u'apache'],[u'iis', u'header', u'server', u'iis'],[u'jetty', u'header', u'server', u'jetty'],[u'nginx', u'header', u'server', u'nginx'],[u'cisco', u'header', u'server', u'cisco'],[u'couchdb', u'header', u'server', u'couchdb'],[u'tplink', u'header', u'WWW-Authenticate', u'TP-LINK'],[u'h3c', u'header', u'WWW-Authenticate', u'h3c'],[u'h3c', u'file', u'index', u'/web/device/login'],[u'huawei', u'header', u'WWW-Authenticate', u'huawei'],[u'netgear', u'header', u'WWW-Authenticate', u'netgear'],[u'hikvision', u'header', u'server', u'DNVRS-Webs'],[u'hikvision', u'header', u'server', u'App-webs'],[u'hikvision', u'header', u'server', u'DVRDVS-Webs'],[u'hikvision', u'header', u'server', u'Hikvision-Webs'],[u'tengine', u'header', u'server', u'Tengine']],
u'Scan_list':u'',
u'Port_list':
u'1|21\n22\n23\n25\n53\n80\n110\n139\n143\n389\n443\n445\n465\n873\n993\n995\n1080\n1311\n1723\n1433\n1521\n3000\n3001\n3002\n3306\n3389\n3690\n4000\n5432\n5900\n6379\n7001\n8000\n8001\n8080\n8081\n8888\n9200\n9300\n9080\n9090\n9999\n11211\n27017',
u'Timeout':u'8',
u'Discern_server':[[u'ftp', u'21', u'banner', u'^220.*?ftp|^220-|^220 Service|^220 FileZilla'],[u'ssh', u'22', u'banner', u'^ssh-'],[u'telnet', u'23', u'banner', u'^\\xff[\\xfa-\\xfe]|^\\x54\\x65\\x6c|Telnet'],[u'smtp', u'25', u'banner', u'^220.*?smtp'],[u'dns', u'53', u'default', u''],[u'pop3', u'110', u'banner', u'\\+OK.*?pop3'],[u'netbios', u'139', u'default', u''],[u'imap', u'143', u'banner', u'^\\* OK.*?imap'],[u'ldap', u'389', u'default', u''],[u'smb', u'445', u'default', u''],[u'smtps', u'465', u'default', u''],[u'rsync', u'873', u'banner', u'^@RSYNCD|^@ERROR'],[u'imaps', u'993', u'