├── config.txt ├── README.md └── IgxeScanLibrary.py /config.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LunaticTian/IGXE_BuyScript/master/config.txt -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # IGXE_BuyScript 2 | IGXE的扫货脚本,理论上支持igxe上的所有商品。 3 | 4 | ## Test 5 | 此阶段属于测试阶段,各项功能还未完全实现。 6 | 7 | ## Rely 8 | * Pyhton 3.0+ 9 | * Selenium 10 | * Itchat 11 | * chrome&chromedriver 12 | 13 | ## 功能 14 | 1. 全自动扫货/支持IGXE上所有商品 15 | 2. 智能化的远程微信提示/基于Itchat 16 | 3. 防封/全程模拟用户操作,间隔超短 17 | 18 | ## 食用教程 19 | 点击config.txt分别填写 20 | 21 | 1. ID:你的登陆用户名 22 | 2. PassWord:你的登陆 23 | 3. Payment_password:你的交易密码 24 | 4. Game:你所扫货的物品所在游戏 25 |
游戏列表对应地址 26 | 1. pubg:pubg 27 | 2. csgo:csgo 28 | 3. h1z1:h1z1/4338 29 | 4. tf2:tf2 30 | 5. 收获日2:pd2 31 | 6. 未转变者:unturned 32 | 7. 腐蚀:rust 33 | 8. 深海惊魂:depth 34 | 9. 杀戮空间:kf2 35 | 10. Steam:card 36 | 5. Product:所扫物品名称(必须是完整且准确的) 37 | 38 | ## 未完成... 39 | 2018/4/4 40 | 41 | 1. 基于微信的控制流程 42 | 2. 更完美的防异常机制 43 | 3. chromedriver的异常退出清理机制 44 | 45 | ## 风险 46 | 虽然该软件理论防封,但是仍然有不可预见性,食用后出现任何风险请后果自负。 47 | 48 | ## 版权说明 49 | 允许任何的修改及出售,但本人不保证也不提供任何服务,望知情。 50 | -------------------------------------------------------------------------------- /IgxeScanLibrary.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | import time 3 | from selenium.common.exceptions import NoSuchElementException 4 | from selenium.webdriver.common.keys import Keys 5 | import itchat 6 | import re 7 | import matplotlib.pyplot as plt 8 | import os 9 | import numpy as np 10 | 11 | 12 | # 加入邮件通知按钮 13 | 14 | 15 | # 文件信息读取 16 | def TxtReading(): 17 | user={} 18 | a=0 19 | file = open("config.txt", "r+") 20 | while 1: 21 | 22 | line = file.readline() 23 | if not line: 24 | break 25 | print(line) 26 | if a == 0: 27 | user['ID'] = line[3:] 28 | if a == 1: 29 | user['PassWord'] = line[9:] 30 | if a == 2: 31 | user['Payment_password'] = line[17:] 32 | if a == 3: 33 | user['Game'] = line[5:] 34 | if a == 4: 35 | user['Product']=line[8:] 36 | a=a+1 37 | return user 38 | 39 | 40 | 41 | # 判断元素存在方法 42 | # 缺点:当元素不存在时判断时间过长 43 | def exist(web, find): 44 | try: 45 | if web.find_element_by_xpath(find): 46 | return 1 47 | except: 48 | return 2 49 | 50 | 51 | # 声明浏览器 返回浏览器对象 52 | def Browser(): 53 | chrome_options = webdriver.ChromeOptions() 54 | # 使用headless无界面浏览器模式 55 | # chrome_options.add_argument('--headless') 56 | # chrome_options.add_argument('--disable-gpu') 57 | # chrome_options.add_argument("--window-size=1280,800") 58 | # chrome_options.binary_location = "C:\Program Files (x86)\Chrome\Application\chromedriver.exe" 59 | # 声明浏览器 60 | # web = webdriver.Chrome(chrome_options=chrome_options) 61 | 62 | web = webdriver.Chrome("H:\Program Files (x86)\Chrome\Application\chromedriver.exe") 63 | prefs = {"profile.managed_default_content_settings.images": 2} 64 | chrome_options.add_experimental_option("prefs", prefs) 65 | web.set_window_size(1280, 800) 66 | return web 67 | 68 | 69 | # 登陆 user:用户名 password:密码 70 | def Log_in(web, user, password): 71 | web.get("https://www.igxe.cn") 72 | # 点击登陆 73 | web.find_element_by_xpath("//*[@id=\"header\"]/div[1]/div/div/div[2]/ul/li[1]/a").send_keys(Keys.ENTER) 74 | # 输入账号密码 75 | web.find_element_by_xpath("//*[@id=\"username\"]").send_keys(str(user)) 76 | web.find_element_by_xpath("//*[@id=\"password\"]").send_keys(str(password)) 77 | # 点击登陆 78 | # web.find_element_by_xpath("//*[@id=\"login-form\"]/div[5]/input").send_keys(Keys.ENTER) 79 | return web 80 | 81 | 82 | 83 | 84 | # Game 购买的那个游戏的专区 85 | # Article 扫物品的名称 86 | # Price 物品需要的价格 87 | # Passwd 交易密码 88 | def Scan(web,Game,Article,Price,Passwd): 89 | 90 | # 转向pubg专区 91 | Game = "https://www.igxe.cn/" + str(Game) 92 | web.get(Game) 93 | # 查询特定衣服 94 | 95 | web.find_element_by_xpath("//*[@id=\"js-search-key\"]").send_keys(Article) 96 | # 点击搜索 97 | web.find_element_by_xpath("//*[@id=\"js-search-key\"]").send_keys(Keys.ENTER) 98 | # 点击搜索出的第一个内容 99 | web.find_element_by_xpath("//*[@id=\"center\"]/div[2]/div/div[3]/ul/li/div[1]/a").send_keys(Keys.ENTER) 100 | web.implicitly_wait(10) 101 | url = web.current_url 102 | pay(web=web,url=url,Price=Price,Passwd=Passwd) 103 | 104 | def pay(web,url,Price,Passwd): 105 | web.get(url) 106 | time.sleep(0.3) 107 | # 点击批量购买 108 | web.find_element_by_xpath("//*[@id=\"js-btn-tradeBuy\"]").click() 109 | # 找到弹出的批量框 110 | web.find_element_by_xpath("//*[@id=\"layui-layer1\"]") 111 | # 清空价格框 112 | web.find_element_by_xpath("//*[@id=\"js-money-end\"]").clear() 113 | # 点击购买的价格 114 | web.find_element_by_xpath("//*[@id=\"js-money-end\"]").send_keys(Price) 115 | 116 | while True: 117 | # 点击查询 118 | print("进入购物车5") 119 | web.find_element_by_xpath("//*[@id=\"js-pop-weaponKey\"]/div[1]/div[2]/dl[3]/dd/div/input").click() 120 | # 强制暂停 等待刷新的页面 121 | time.sleep(0.4) 122 | web.implicitly_wait(10) 123 | a = web.find_element_by_xpath("//*[@id=\"js-size\"]").text 124 | # 判断物品 125 | print(a) 126 | if int(a) == None: 127 | continue 128 | if int(a) > 0: 129 | try: 130 | print("进入购物车") 131 | # 点击购物车 132 | web.find_element_by_xpath("//*[@id=\"js-add-standard-cart\"]").click() 133 | # 输入支付密码 134 | Available_Balance = web.find_element_by_xpath( 135 | "//*[@id=\"pay_order_form\"]/div[2]/div[2]/ul/li/label/p[2]/b").text.strip("¥") 136 | Available_Car = web.find_element_by_xpath('//*[@id="span_pay_money"]').text 137 | print(Available_Balance + " " + Available_Car) 138 | print("进入购物车1") 139 | # if web.find_element_by_xpath("//*[@id=\"pay_order\"]").is_displayed(): 140 | # print("!!!!!") 141 | # web.find_element_by_xpath("//*[@id=\"js-shopping-cart\"]/div/a").click() 142 | # web.find_element_by_xpath("//*[@id=\"pay_order_form\"]/div[4]/div[2]/span/a[1]").send_keys( 143 | # Keys.ENTER) 144 | # pass 145 | if Available_Balance > Available_Car: 146 | print("进入!!!") 147 | web.find_element_by_xpath("//*[@id=\"pay-pwd\"]").send_keys(Passwd) 148 | web.find_element_by_xpath("//*[@id=\"pay_order\"]").send_keys(Keys.ENTER) 149 | # web.find_element_by_xpath("//*[@id=\"layui-layer2\"]") 150 | web.find_element_by_link_text("确定").click() 151 | web.find_element_by_link_text("确定").click() 152 | itchat.send_msg('扫号成功!') 153 | pay(web=web, url=url, Price=Price, Passwd=Passwd) 154 | elif Available_Balance < Available_Car: 155 | print("余额不足,请充值!") 156 | itchat.send_msg('余额不足,请充值!') 157 | web.quit() 158 | break 159 | print("进入购物车2") 160 | # web.find_element_by_xpath("//*[@id=\"layui-layer1\"]/div[3]/a[1]").click() 161 | except: 162 | # 判断失效物品 163 | print("进入购物车3") 164 | if exist(web, "//*[@id=\"js-shopping-cart\"]/div/a") == 1: 165 | print("123") 166 | web.find_element_by_xpath("//*[@id=\"js-shopping-cart\"]/div/a").click() 167 | web.implicitly_wait(3) 168 | # 判断价格 169 | if exist(web, "//*[@id=\"pay_order_form\"]/div[4]/div[2]/span") == 1: 170 | web.find_element_by_xpath("//*[@id=\"pay_order_form\"]/div[4]/div[2]/span") 171 | print("321") 172 | web.find_element_by_link_text("确认").send_keys(Keys.ENTER) 173 | web.find_element_by_xpath("//*[@id=\"pay_order_form\"]/div[4]/div[2]/span/a[1]").send_keys( 174 | Keys.ENTER) 175 | print("进入购物车4") 176 | web.find_element_by_xpath("//*[@id=\"pay-pwd\"]").send_keys(Passwd) 177 | web.find_element_by_xpath("//*[@id=\"pay_order\"]").send_keys(Keys.ENTER) 178 | # web.find_element_by_xpath("//*[@id=\"layui-layer2\"]") 179 | web.find_element_by_link_text("确定").click() 180 | web.find_element_by_link_text("确定").click() 181 | pay(web=web, url=url, Price=Price, Passwd=Passwd) 182 | time.sleep(3) 183 | web.quit() 184 | @itchat.msg_register(itchat.content.TEXT) 185 | def text_reply(msg): 186 | # 返回同样的文本消息 187 | print(msg['Text']) 188 | 189 | if __name__ == "__main__": 190 | itchat.auto_login(hotReload=True) 191 | #itchat.send('text', toUserName='filehelper') 192 | # print("123") 193 | # itchat.run() 194 | user = TxtReading() 195 | id = user['ID'] 196 | password = user['PassWord'] 197 | Payment_password = user['Payment_password'] 198 | Game = user['Game'] 199 | Product = user['Product'] 200 | 201 | a = Log_in(web=Browser(),user=id,password=password) 202 | Scan(web=a, Game=Game, Article = Product, Price="1", Passwd=Payment_password) 203 | --------------------------------------------------------------------------------