最近一直在研究冰狐智能輔助,上次利用冰狐智能輔助實作了一個免費的個人收款系統,用起來還行,說實話剛開始我有懷疑過平臺的穩定性,現在看來是有點多慮了,最近看官網更新了一個針對菜鳥設計的通過配置直接生成腳本功能「自動構建」,個人覺得很好奇,有點高大上,于是利用約會的時間研究了一把,用「自動構建」,沒寫一行代碼,實作了一個薅羊毛程式(純屬個人興趣研究,禁止用于任何商業用途),現把該薅羊毛程式作為例子進行講解,分享菜鳥(不會編程的同學)是如何快速實作輔助功能的,
準備作業
- 手機端安裝「冰狐智能輔助」,詳細安裝程序請看這里,
- 手機端安裝「愛奇藝極速版」v1.10.6,注意,必須安裝這個版本,不同的版本操作界面可能不同,可能會導致輔助功能失效,點擊這里從豌豆莢官網下載該版本,
- 注冊「愛奇藝極速版」用戶并登陸,
制作輔助功能
- 進入「移動端」/「自動構建」,新建名為”愛奇藝極速版“的自動構建,
- 點擊“配置原始碼”按鈕,將如下json資料粘貼進去,保存,
{ "type": "root", "children": [{ "type": "declareVar", "var": [{ "name": "ret", "type": "normal", "initType": "null", "initValue": "null" }, { "name": "view", "type": "normal", "initType": "null", "initValue": "null" }, { "name": "viewContainer", "type": "normal", "initType": "null", "initValue": "null" }, { "name": "item", "type": "normal", "initType": "null", "initValue": "null" }], "desc": "變數宣告" }, { "type": "launchApp", "packageName": "com.qiyi.video.lite", "findTag": "txt:首頁-", "failed": "exitPopup", "maxStep": "30", "children": [{ "type": "log", "log": "啟動app成功", "desc": "啟動成功日志", "info": ["string-app啟動成功"], "log_type": "log" }, { "type": "switchPage", "returnVar": "", "findTag": "txt:開寶箱-", "checkTag": "txt:活動規則-", "root": "", "click": "true", "failed": "exitPopupWithAD", "descendant": "[]", "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0", "children": [{ "type": "log", "desc": "開始日志", "log_type": "log", "info": ["string-進入任務"] }, { "type": "task", "scrollCount": "2", "returnTag": "txt:活動規則-", "taskDeal": [{ "key": "txt^:免費抽大獎-", "value": { "type": "switchPage", "desc": "切換到幸運大轉盤", "returnVar": "", "findTag": "txt^:免費抽大獎-", "checkTag": "txt:幸運大轉盤-", "root": "", "click": "true", "failed": "exitPopupWithAD", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0", "children": [{ "type": "loop", "desc": "回圈多次處理抽獎", "class": "2", "startIndex": "0", "endIndex": "20", "children": [{ "type": "findView", "desc": "搜索控制元件", "viewDeal": [{ "key": "txt^:恭喜到賬-traverse_one_by_one", "value": { "type": "loop", "desc": "退出到賬", "class": "4", "container": "view", "descendant": "[-1,-1]", "children": [{ "type": "if", "desc": "條件處理", "expr": "item.clickable", "children": [{ "type": "log", "desc": "日志", "log_type": "log", "info": ["string-click x,and exit"] }, { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": [], "beforeWait": "0", "afterWait": "0", "target": "item" }, { "type": "break", "desc": "跳出回圈" }] }] } }, { "key": "txt$:后再來-", "value": { "type": "break", "desc": "跳出回圈" } }, { "key": "txt^:lottery-list-", "value": { "type": "custom", "desc": "抽獎", "code": "var txt = view.parent.parent.parent[2][0].text;\nconsole.log('txt:' + txt);\nvar num = parseInt(txt);\nif (num > 0) {\ngestureClick((view.left + view.right) / 2, (view.top + view.bottom) / 2, {afterWait: 8000});\nconsole.log('點擊開始抽獎');\n} else {\nconsole.log('抽獎結束');\nbreak;\n}" } }, { "key": "txt^:lottery-list-", "value": { "type": "if", "desc": "條件處理", "expr": "parseInt(view.parent.parent.parent[2][0].text)>0", "children": [{ "type": "click", "desc": "點擊控制元件", "class": "4", "duration": "500", "beforeWait": "0", "afterWait": "8000", "x": "0", "y": "0", "unit": "px" }] } }], "root": "", "failed": "exitPopupWithAD", "duration": "500", "maxStep": "10", "beforeWait": "0", "afterWait": "0", "false": { "type": "break", "desc": "跳出回圈" } }], "descendant": [] }, { "type": "back2Page", "desc": "回傳頁面", "returnVar": "", "tag": "txt:我的|txt:活動規則-", "root": "", "backFirst": "true", "failed": "", "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0" }], "false": { "type": "log", "desc": "日志", "log_type": "error", "info": ["string-切換到大轉盤失敗"] } } }, { "key": "txt:開寶箱領金幣|txt$:每日可領-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": [], "beforeWait": "0", "afterWait": "1000", "target": "view" } }], "maxDealCount": "8", "failed": "exitPopupWithAD", "desc": "任務處理", "removeTag": true }, { "type": "log", "desc": "結束日志", "log_type": "log", "info": ["string-任務結束"] }], "desc": "切換到任務頻道", "false": { "type": "log", "desc": "日志", "log_type": "error", "info": ["string-進入任務失敗"] } }, { "type": "switchPage", "returnVar": "", "findTag": "txt:首頁-", "checkTag": "txt:電視劇-", "root": "", "click": "true", "failed": "exitPopupWithAD", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0", "children": [{ "type": "mainLoop", "minRunTime": "2", "maxRunTime": "5", "minScrollCount": "1", "maxScrollCount": "3", "containerTag": "cn:androidx.recyclerview.widget.RecyclerView-", "failed": "exitPopupWithAD", "children": [{ "type": "log", "log": "開始看視頻了哦", "desc": "日志", "info": ["string-開始看電視了哦"], "log_type": "log" }, { "type": "loopPicker", "desc": "從回圈中挑選某些項處理", "startIndex": "1", "lastIndex": "1", "random": true, "children": [{ "type": "click", "desc": "點擊電視", "class": "2", "click": "true", "descendant": [], "beforeWait": "0", "afterWait": "0", "target": "sChild" }, { "type": "findView", "desc": "查看是否進入電視", "returnVar": "", "tag": "txt*:/|txt:金蛋獎勵-", "root": "", "failed": "exitPopup", "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0", "children": [{ "type": "loop", "desc": "看電視", "breakTag": "txt:完成-", "failed": "", "minRunTime": "0.5", "maxRunTime": "1.2", "class": 1 }], "viewDeal": [{ "key": "txt*:/|txt:金蛋獎勵-", "value": { "type": "loop", "desc": "看電視", "class": 1, "breakTag": "txt:完成-", "failed": "exitPopup", "minRunTime": "0.7", "maxRunTime": "1.2", "descendant": [], "children": [{ "type": "click", "desc": "關閉廣告", "class": 1, "tag": "txt:關閉此廣告-", "root": "", "click": "true", "failed": "", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0" }] } }], "false": { "type": "log", "desc": "日志", "log_type": "log", "info": ["string-進入電視失敗"] } }, { "type": "click", "desc": "領金幣", "class": 1, "tag": "txt:領金幣-", "root": "", "click": "true", "failed": "", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0" }, { "type": "click", "desc": "領不固定金幣", "class": 1, "tag": "txt^:領-", "root": "", "click": "true", "failed": "", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0" }, { "type": "back2Page", "desc": "回傳頁面", "returnVar": "", "tag": "txt:我的-", "root": "", "backFirst": "true", "failed": "", "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0" }] }], "returnTag": "txt:我的-", "skipProb": "80", "desc": "滾動螢屏看電視", "findContainerFailed": {} }], "desc": "切換到電視劇頻道", "false": { "type": "log", "desc": "日志", "log_type": "error", "info": ["string-進入看電視失敗"] } }, { "type": "switchPage", "desc": "切換到短視頻", "returnVar": "", "findTag": "txt:短視頻-", "checkTag": "txt:推薦-", "root": "", "click": "true", "failed": "exitPopupWithAD", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0", "false": { "type": "log", "desc": "切換失敗日志", "log_type": "error", "info": ["string-切換短視頻失敗"] }, "children": [{ "type": "mainLoop", "desc": "主回圈", "containerTag": "cn:androidx.recyclerview.widget.RecyclerView-", "returnTag": "-", "skipProb": "0", "failed": "exitPopup", "minRunTime": "2", "maxRunTime": "3", "minScrollCount": "1", "maxScrollCount": "1", "children": [{ "type": "log", "desc": "日志", "log_type": "log", "info": ["string-開始看小視頻了"] }, { "type": "loop", "desc": "回圈", "breakTag": "", "failed": "", "minRunTime": "0.1", "maxRunTime": "0.5", "class": 1 }, { "type": "break", "desc": "跳出回圈" }] }] }], "false": { "type": "log", "log": "啟動APP失敗", "desc": "日志", "log_type": "error", "info": ["string-啟動app失敗"] }, "desc": "啟動APP" }, { "type": "popup", "name": "exitPopup", "exitPopupDeal": [{ "key": "txt:暫不升級|txt:我知道了-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": [], "beforeWait": "0", "afterWait": "0", "target": "view" } }, { "key": "txt:猜你想看-", "value": { "type": "click", "desc": "點擊控制元件", "class": 1, "tag": "txt:取消-", "root": "", "click": "true", "failed": "", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0" } }, { "key": "txt^:再賺-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "false", "descendant": [], "beforeWait": "0", "afterWait": "0", "target": "view" } }, { "key": "txt:恭喜獲得-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": [-1, 4], "beforeWait": "0", "afterWait": "0", "target": "view" } }, { "key": "txt^:恭喜到賬-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": [-1, 2, 0], "beforeWait": "0", "afterWait": "0", "target": "view" } }, { "key": "txt:繼續賺錢-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": "[-1,-1,-1,1]", "beforeWait": "0", "afterWait": "0", "target": "view" } }, { "key": "txt^:打開日歷提醒-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": "[-1,7]", "beforeWait": "0", "afterWait": "0", "target": "view" } }], "false": "[]", "desc": "處理彈窗" }, { "type": "popup", "name": "exitPopupWithAD", "exitPopupDeal": [], "false": ["exitPopup", "dealAD"], "desc": "處理彈窗和廣告" }, { "type": "ad", "enterWindowList": "[\"com.mcto.sspsdk.ssp.activity.QyTrueViewActivity\"]", "enterTags": "txt*:s后可領取獎勵-", "breakTags": "txt:開寶箱|txt:我的|txt^:再賺|txt:繼續賺錢|txt:幸運大轉盤-", "exitDeal": [{ "key": "txt:關閉-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": [], "beforeWait": "0", "afterWait": "0", "target": "view" } }, { "key": "txt:恭喜獲得-", "value": { "type": "click", "desc": "點擊控制元件", "class": "2", "click": "true", "descendant": [-1, 4], "beforeWait": "0", "afterWait": "0", "target": "view" } }, { "key": "cn:android.widget.ImageView-find_all|clickable", "value": { "type": "loop", "desc": "回圈", "class": "4", "container": "viewContainer", "children": [{ "type": "custom", "desc": "自定義模塊,直接寫入代碼", "code": "if (item.width == item.height && item.width < 80 && item.width > 40 && item.top < 100 && item.right > (rsScreenWidth - 20)) {\nclick(item, {click: true});\nconsole.log('click x');\nbreak;\n}" }], "descendant": "[]" } }, { "key": "txt:繼續觀看視頻可獲得獎勵-", "value": { "type": "click", "desc": "點擊控制元件", "class": 1, "tag": "txt:繼續觀看-", "root": "", "click": "true", "failed": "", "descendant": [], "duration": "500", "maxStep": "5", "beforeWait": "0", "afterWait": "0" } }], "desc": "處理廣告" }, { "type": "windowChange", "windowDeal": [], "desc": "視窗變化處理" }, { "type": "notification", "children": [], "filter": "", "desc": "通知處理" }], "desc": "根模塊" } - 點擊“編譯”按鈕,把構建編譯成js代碼,
- 進入「移動端」/「移動端腳本」,系統會自動創建一個“愛奇藝極速版”js腳本,點擊“發布”按鈕,發布腳本,
- 點擊“運行”按鈕,選擇設備,執行腳本,一個自動薅羊毛的輔助程式就完成啦😊,
原理分析
看到這,其實最核心的就是如何得到配置json資料,下面我們一起來看下我是如何配置的:
進入「移動端」/「自動構建」,選擇“愛奇藝極速版”,然后點擊“配置構建”按鈕,這時候彈出一個配置界面,如下圖所示:

配置由模塊組成,每個模塊由模塊屬性和子模塊組成,一般的模塊會直接執行子模塊,有的帶條件的模塊,當條件為true或者執行結果為true時才執行子模塊,注意:子模塊是按按順序執行,整個配置其實就是一個樹形結構,上圖就是根模塊,下面來介紹下每個模塊作用:
變數宣告
宣告一些后面模塊要用的通用變數,系統會自動生成幾個常用的變數,個人感覺絕大部份情況下系統默認生成的就夠用了😄,點擊“編輯”按鈕,再點擊“查看/編輯變數宣告”,顯示如下變數:

啟動APP
如果打算啟動和處理APP,必須添加這個模塊,點擊該模塊的“編輯”按鈕,屬性和子模塊如下圖所示:

「每個屬性行的最后都有一個說明,滑鼠移動上去會自動顯示詳細說明,」
屬性如下:
- packageName,APP的包名
- findTag,這個是用來檢測app是否已經啟動,app啟動了,首頁中如果出現該tag,則表示啟動成功,
- false,啟動app失敗后會執行該模塊,打了個log😯,
- failed,用來處理隨機彈窗的問題,如果系統隨機彈出什么升級啊等視窗時,這個可以自動處理🐂,
- maxStep,檢測是否啟動,最多find幾次tag,默認好像是30次,
成功啟動app后,會自動按順序執行子模塊:
- 打log,用于除錯吧,
- 切換到任務頻道,做任務,
- 切換到電視劇頻道,看電視劇,
- 切換到短視頻頻道,看短視頻,
處理彈窗
用于處理app隨機彈出的各種視窗,比如:升級、青少年模式、處理成功等等對話框,

屬性如下:
- exitPopupDeal,用于處理彈窗,點擊后面的"查看/編輯map"

- false,模塊陣列,當無法處理彈窗時,會按順序執行模塊,如果回傳true則不執行,否則繼續執行下一個,
處理彈窗和廣告
用于即有可能出現彈窗也有可能出現廣告的場景,false屬性值["exitPopup","dealAD"],表示先處理彈窗,如果失敗,則看看是否是廣告,處理廣告,

處理廣告
處理彈出廣告的情況,當廣告完成后自動退出廣告,廣告不會自動觸發,一般是在點擊某個按鈕后彈出廣告,

屬性如下:
- enterWindows,廣告視窗className的陣列,當出現其中一個視窗時,表示進入廣告,
- enterTags,廣告視窗中某個標識性控制元件的tag陣列,當出現其中一個tag時,表示進入了廣告,
- breakTags,廣告退出后顯示頁面的標志性tag陣列,當出現其中一個tag時,表示廣告已經退出,
- exitDeal,退出處理,當出現點擊退出廣告的按鈕時,點擊按鈕,

視窗變化處理
可以用于處理比如,當視窗改變后,系統會自動觸發該模塊,
通知處理
用于處理各種通知,比如微信訊息,短信等等,當出現通知時,系統會自動觸發該模塊,
總結
通過這幾天的研究,總體感徑訓可以,能通過配置完成絕大多數功能,但也有缺點,就是檔案太少了,很多屬性需要自己研究,希望官方以后會多多完善檔案,
本文只介紹了部分模塊,還有其他模塊這里沒有介紹完,如果大家感興趣的話,我后續再繼續出專題,有任何問題,歡迎大家留言,一起交流😊
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/382033.html
標籤:其他
