以前嘗試用過virjar大佬的hermesagent, 後來大佬又迭代出新的基於長連接的Sekiro
, 一直想看都被耽擱了, 今天正好抽空嘗試一下, 順便寫篇筆記, 有錯誤的地方大佬們請指正哈html
SEKIRO 是一個android下的API服務暴露框架,能夠用在app逆向、app數據抓取、android羣控等場景
和其餘羣控框架相比的特色以下:java
Sekiro架構python
server: 暴露一個TCP端口和兩個HTTP端口 管理經過TCP鏈接的client和user發來的http 請求 client: 經過TCP和server鏈接,響應server發來的請求 工做流程是這樣的: 1. client經過TCP和server創建長鏈接 2. user發送http請求給server 3. server根據用戶發來的http請求的參數,經過TCP將請求轉發給client 4. client收到請求並響應server 5. server將從client收到的請求返回給user
詳細的能夠去看項目的readme, 說的很是詳細: 項目傳送門android
git clone [https://github.com/virjar/sekiro.git](https://github.com/virjar/sekiro.git)
include ':sekiro-server', ':sekiro-lib'
,刪掉appdemo防止編譯它server端在`sekiro-server/src/main/resources/appliation.properties`中能夠配置三個服務端端口, 主要服務端安全策略的出入口須要開放這個三個端口 #tomcat 佔用端口 server.port=5602 #長連接服務佔用端口 natServerPort=5600 # 異步http佔用端口 natHttpServerPort=5601 # websocket佔用端口 webSocketServerPort=5603 若是自定義端口,client須要調用SekiroClient.start(String serverHost, int serverPort, final String clientID, String group)中去鏈接server
執行命令:./gradlew sekiro-server:bootJar
便可在 sekiro-server/build/libs/sekiro-server-0.0.1-SNAPSHOT.jar
找到all-in-one的jar包git
nohup java -jar sekiro-server/build/libs/sekiro-server-0.0.1-SNAPSHOT.jar >/dev/null 2>&1 &
啓動serverandroid.permission.INTERNET
權限public class MainActivity extends AppCompatActivity { public static int Add(int n1, int n2) { return n1 + n2; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toast.makeText(MainActivity.this, "3 + 2 = " + Add(3, 2), Toast.LENGTH_LONG).show(); } }
implementation 'com.virjar:sekiro-api:1.0.1'
handleLoadPackage
中啓動client連接server,並添加處理事件的handler, 用於調用Add函數Log.i(TAG, "connect server...."); //服務端host String testHost = "your_host"; //客戶端標識 String clientId = UUID.randomUUID().toString(); //接口組名稱 String groupName = "addDemoTest2"; //暴露的接口名稱 String actionName = "myAdd"; //拿classloader clzLoader = lpparam.classLoader; //鏈接服務端而且註冊處理的handler SekiroClient.start(testHost, clientId, groupName) .registerHandler(actionName, new SekiroRequestHandler(){ @Override public void handleRequest(SekiroRequest sekiroRequest, SekiroResponse sekiroResponse){ //當服務端分配任務時, 這裏處理邏輯, 並把結果返回給服務端, 服務端再返回給調用者 Class<?> clz = XposedHelpers.findClass("com.example.administrator.adddemo.MainActivity", clzLoader); int arg1 = sekiroRequest.getInt("arg1"); int arg2 = sekiroRequest.getInt("arg2"); Log.i(TAG, String.format("arg1 : %d, arg2 : %d", arg1, arg2)); Object result = XposedHelpers.callStaticMethod(clz, "Add", arg1, arg2); Log.i(TAG, "result : " + result); sekiroResponse.success(result); } });
More than one file was found with OS independent path
解決//build.gradle裏android{}添加錯誤的path packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/INDEX.LIST' exclude ('META-INF/io.netty.versions.properties') }
[your_server_ip]:[server.port]/groupList
格式: your_server_ip:[natHttpServerPort]/[invoke_type]?group=[group_id]&action=[action_name]¶m1=[arg] 例子: https://x.x.x.x:5602/asyncInvoke?group=addDemoTest2&action=myAdd&arg1=300&arg2=300
sekiro實踐
github
更多短視頻數據實時採集接口,請查看文檔: TiToDataweb
免責聲明:本文檔僅供學習與參考,請勿用於非法用途!不然一切後果自負。api