Ghost网安小组-Ghostgroup

 找回密码
 立即注册
搜索
热搜: 渗透
查看: 2872|回复: 0

短目录爆破+端口开放扫描py2.7

[复制链接]

114

主题

125

帖子

2020万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
20200813
QQ
发表于 2018-8-29 14:50:24 | 显示全部楼层 |阅读模式
No.1 =>短目录py
# -  *  - 编码:UTF-8  -  *  -从线程导入

导入请求

线程,activeCount

导入队列



队列= Queue.Queue()

dir_file ='demo.txt'def



scan_target_url_exists(target_url):

    headers = {

        'Accept':'text / html,application / xhtml + xml,application / xml; q = 0.9,* / *; q = 0.8',

        'User-Agent':'Mozilla / 5.0(Windows NT 10.0; WOW64)AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 55.0.2883.87 Safari / 537.36',

        'Accept-Language':'zh-CN,zh; q = 0.9,en; q = 0.8',

        'Accept-Encoding' :'gzip,deflate',

        'Referer':'http://www.google.com'}

    status_codes = [200]

    尝试:

        req = requests.head(target_url.strip(),timeout = 8,headers = headers)

        如果status_codes中的req.status_code:print'CODE

            :%s,URL:%s'%(str(req.status_code),target_url。 strip('\ n')。strip('\ r'))

            open('exists_target_url.txt','a')。write(target_url)

    除了:

        传递

def open_pathfile(文件):

    all_lines = open(file,'r ').readlines()

    for all_lines 中的行:

        if target_url.endswith ('/'):

            if line.startswith('/'):

                queue.put(target_url + line [1:])

            else:

                queue.put(target_url + line)

        else:

            if line.startswith('/'):

                queue.put(target_url + line)

            else:

                queue.put(target_url +'/'+ line)



if __name__ =='__ main__':

    print'''

____ _ ____                  

| _ \(_)_ __ / ___ | ___ __ _ _ __   

| | | | | '__ \ ___ \ / __ / _` | '_ \

| | _ | | | | ___)| (_ |(_ | | | | |

| ____ / | _ | _ | | ____ / \ ___ \ __,_ | _ | | _ |



    '''

    target_url = raw_input('请输入您的目标:')

    threadnum = raw_input('请输入你的threadnum:')

    如果target_url.startswith('http://')或target_url.startswith('https://'):

        传递

    else:

        target_url ='http://'

    print'线程数是%s'%threadnum

    print'匹配.......'

    open_pathfile(dir_file)

    而queue.qsize()> 0:

        if activeCount()<= int(threadnum):

            线程(目标) = scan_target_url_exists,args =(queue.get(),))。start()

NO.2 =>端口开放扫描
# -  *  - 编码:UTF-8  -  *  -

导入套接字

导入线程



lock = threading.Lock()

线程= []

def Get_ip(domain):   

    try:   

        return socket.gethostbyname(domain)   

    除了socket.error,e:

        print'[ - ]%s:%s'%(domain,e)   

        return 0



def PortScan(ip,port) ):

    try:

        s = socket.socket()

        s.settimeout(0.1)

        s.connect((ip,port))

        lock.acquire()

        openstr =“[ - ] PORT:”+ str(port)+“OPEN”

        print openstr

        lock.release()

        s.close( )

    除了:

        传递

def main():

    banner ='''

                      _                        

     _ __ ___ _ __ | | _ ___ ___ __ _ _ __   

    | '_ \ / _ \ | “__ | __ / __ | / __ / _` | '_ \

    | | _)| (_)| | | | _ \ __ \ _(_ |(_ | |

    |||| .__ / \ ___ / | _ | \ __ | ___ / \ ___ \ __,_ | _ | | _ |

    | _ |                                       



            '''

    打印横幅

    domain = raw_input(“

    ip = Get_ip(domain)

    print'[ - ] IP:'+ ip

    for n in range(1,76):

        for p in range((n-1)* 880,n * 880):

            t = threading.Thread( target = PortScan,args =(ip,p))

            threads.append(t)

            t.start()      



        用于线程中的t:

            t.join()

    print'此扫描已完成!'

if __name __ =='__ main__':   

    main()




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
We Are Ghost
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ| Ghost网安小组-Ghostgroup |网站地图

GMT+8, 2024-4-27 00:12

Powered by Aatrox

© 2001-2020 We Are Ghost

快速回复 返回顶部 返回列表