wing-port-scan


Alt text

Alt text
体验了下figlet这个工具,然后将就写了个端口扫描的脚本,效率肯定没有人家专业的高,当做练手吧!

```python python

#!/usr/bin/env python

* coding:utf-8 *

Author : wing

blog : http://hackerwing.com

import threading
import time
from socket import socket
import sys
from datetime import datetime

logo = r’’’


\ \ / () | \ | | / __| _
\ \ /\ / /| | ‘ \ / ` |___
| |) / | ‘| |\ \ / / ` | ‘ \
\ V V / | | | | | (| |__
| / () | | | ||__|) | (| (| | | | |
_/_/ ||| |_|\
, | || __/|| __| |__/ \_,|| ||
|___/

                                                    blog:http://hackerwing.com
                                                    Email:admin#hackerwing.com

‘’’

重写class

class ScanThread(threading.Thread):

def init(self, ip, port1, port2, c):

threading.Thread.init(self)

self.ip = ip

self.port1 = port1

self.port2 = port2

self.c = c

#

def run(self):

scan_port(self.ip,self.port1, self.port2, self.c)

def scan_port(ip, port1, port2, c):

for port in range(port1, port2):
    start_time = datetime.now()
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    socket.setdefaulttimeout(c)
    result = sock.connect_ex((ip, port))

    if result == 0:
        print "Nice![+] Open Port-----%s\n" % (port)
        sock.close()
    if port2 == port:
        end_time = datetime.now()
        total_time = end_time - start_time
        print "Congratulation! scanning comlete,spent\t ", total_time
        print "[+] Exiting......"

print “-“60
print logo
print “-“
60

target = str(raw_input(“>please input D|d(domain) or input I|i(ip)!”))

if (target == “D” or target == “d”):
server = str(raw_input(“>please input you want to scan domain!”))
target_ip = socket.gethostbyname(server)
elif (target == “I” or target == “i”):
target_ip = str(raw_input(“>please input you want to scan ip[*]”))

else:
print “please check your input!”
sys.exit()

port1 = int(raw_input(“>please input you want to start port_num[]”))
port2 = int(raw_input(“>please input you want to end port_num[
]”))
thread_num = int(raw_input(“>please input you want to end thread_num[]”))
connect = raw_input(“>Enter L|l is long conectivity and Enter S|s is short connectivity[
]”)

if (connect == “L” or connect == “l”):
c = 1.5
elif (connect == “S” or connect == “s”):
c = 0.5
else:
print “Enter error! “
sys.exit()
print “\n wing-port-scan is scanning—-“ , target_ip
print “-“*60

try:

# threads = []
for i in range(thread_num):
    t = threading.Thread(target=scan_port, args=(target_ip,port1,port2,c,))
    t.start()

except :
print “[!]unable start!”

print “current number of threads:”, threading.activeCount()

```
演示图:

Alttext


   转载规则


《wing-port-scan》 Wing 采用 知识共享署名 4.0 国际许可协议 进行许可。
 上一篇
windows常用hacker-command windows常用hacker-command
0X01 前言命令主要针对渗透测试人员,主要的功能有: 执行一些安全管理的任务 进行漏洞扫描 windows工具的升级 …… 测试已安装的补丁emmm,先介绍一下wmic吧。 WMIC扩展WMI(Windows Management
2017-12-20 Wing
下一篇 
Reverse Shell 备忘录 Reverse Shell 备忘录
在渗透测试中,若目标存在命令执行漏洞,我们的最终目标是获得目标的系统权限,在那之前我们可以利用命令执行建立一个交互式shell,环境不同,反弹shell的姿势也不一样,下面的根据不同环境来量身定制! bash```bash bash
2017-12-19
  目录