3030
3131LOGFILE = True
3232
33- pDescr = {'Country' : '(UK, DE, FR, ...)' , 'CardMonth' : '(01, 02, ..., 12)' , 'Name' : '(first and last name)' }
33+ EUpDescr = {'Country' : '(UK, DE, FR, ...)' , 'CardMonth' : '(01, 02, ..., 12)' , 'Name' : '(first and last name)' , 'CardType' : '(or enter "Paypal")' }
34+ USpDescr = {'Country' : '(USA or CANADA)' , 'CardMonth' : '(01, 02, ..., 12)' , 'Name' : '(first and last name)' , 'Addr3' : '(State abbreviation: AL, AK, AS, ...)' }
3435
3536paydetails = OrderedDict (
36- [('Name' , '' ), ('Email' , '' ), ('Phone' , '' ), ('Addr1' , '' ), ('Addr2' , '' ),
37- ('Addr3' , '' ),
38- ('City' , '' ), ('Post/zip code' , '' ), ('Country' , '' ), ('Cardno' , '' ),
39- ('CardCVV' , '' ),
40- ('CardMonth' , '' ), ('CardYear' , '' ), ('CardType' , '' )])
37+ [('Name' , '' ), ('Email' , '' ), ('Phone' , '' ), ('Addr1' , '' ), ('Addr2' , '' ), ('Addr3' , '' ),
38+ ('City' , '' ), ('Post/zip code' , '' ), ('Country' , '' ), ('CardType' , '' ), ('Cardno' , '' ),
39+ ('CardCVV' , '' ), ('CardMonth' , '' ), ('CardYear' , '' )])
4140
4241categoryList = ['jackets' , 'shirts' , 'tops_sweaters' , 'sweatshirts' , 'pants' , 'hats' , 'bags' ,
4342 'accessories' , 'shoes' , 'skate' ]
@@ -73,7 +72,6 @@ def writeLog(txt):
7372
7473
7574def selectSize ():
76- global sizeC
7775 sizeC = 0
7876 sizes = ["Small" , "Medium" , "Large" , "XLarge" ]
7977 print ("Select Size (Alternatively simply enter 'D' for the first available size)" )
@@ -86,7 +84,7 @@ def selectSize():
8684 if sizeInput in sizes :
8785 return sizeInput
8886 elif sizeInput == "D" :
89- sizeC = 1
87+ return sizeInput
9088 else :
9189 print ("Please enter one of the listed sizes exactly" )
9290 print (sizeInput )
@@ -100,17 +98,13 @@ def selectSize():
10098 if 'US ' in sizeInput and ' / UK ' in sizeInput :
10199 return sizeInput
102100 elif sizeInput == "D" :
103- sizeC = 1
101+ return sizeInput
104102 else :
105103 print ("Please enter a correctly formated size" )
106104 return selectSize ()
107105
108106 else :
109107 sizeInput = input ("Select size: " ).title ()
110- if sizeInput == "D" :
111- sizeC = 1
112- elif sizeInput != "D" :
113- sizeC = 2
114108 return sizeInput
115109
116110
@@ -138,10 +132,22 @@ def check_exists_by_xpath(xpath, driver):
138132
139133
140134def returnTime ():
141- timeS = "Please enter the hour of the drop (e.g. if you're in the UK enter '11' for 11.00am) "
135+ timeEU = "Please enter the hour of the drop (e.g. if you're in the UK enter '11' for 11.00am) "
136+ timeUS = "Please enter the hour of the drop "
137+ if reg == 'EU' :
138+ timeS = timeEU
139+ elif reg == 'US' :
140+ timeS = timeUS
142141
143142 isTime = input (timeS )
144- dropTime = int (isTime )
143+ if len (isTime ) < 0 :
144+ print ('Invalid input' )
145+ sys .exit (1 )
146+ try :
147+ dropTime = int (isTime )
148+ except :
149+ print ('Invalid input' )
150+ sys .exit (1 )
145151 text = "Drop selected for "
146152 text += isTime
147153 text += ":00"
@@ -157,12 +163,12 @@ def returnTime():
157163
158164
159165def sendKeys (value , field , driver ):
160- if len (value ) <= 1 :
166+ if len (value ) < 1 :
161167 return None
162168 try :
163169 driver .execute_script ("arguments[0].value = '" + value + "';" , field )
164170 except WebDriverException :
165- pass
171+ print ( field . get_attribute ( 'Name' ))
166172
167173
168174def selectText (value , obj , attr = False ):
@@ -230,8 +236,11 @@ def searchItem(item):
230236 time .sleep (0.5 + random ())
231237
232238 try :
233- if sizeC != 1 :
234- size = Select (driver .find_element_by_id ("size" ))
239+ if item ['selectedSize' ] != 'D' :
240+ if reg == 'EU' :
241+ size = Select (driver .find_element_by_id ("size" ))
242+ elif reg == 'US' :
243+ size = Select (driver .find_element_by_id ("s" ))
235244 op = size .options
236245 found = False
237246 for x in op :
@@ -270,7 +279,7 @@ def openChrome():
270279
271280
272281def cart ():
273- cart = check_exists_by_xpath ( """//*[@id="cart"]/a[2]""" , driver )
282+ cart = driver . find_elements_by_class_name ( 'checkout' )[ 0 ]
274283 cart .click ()
275284
276285 name = check_exists_by_xpath ("""//*[@id="order_billing_name"]""" , driver )
@@ -288,39 +297,50 @@ def cart():
288297 add2 = check_exists_by_xpath ("""//*[@id="oba3"]""" , driver )
289298 sendKeys (paydetails ['Addr2' ], add2 , driver )
290299
291- add3 = check_exists_by_xpath ("""//*[@id="order_billing_address_3"]""" , driver )
292- sendKeys (paydetails ['Addr3' ], add3 , driver )
300+ country = Select (driver .find_element_by_name ("order[billing_country]" ))
301+ selectText (paydetails ['Country' ], country , True )
302+
303+ if reg == 'EU' :
304+ add3 = check_exists_by_xpath ("""//*[@id="order_billing_address_3"]""" , driver )
305+ sendKeys (paydetails ['Addr3' ], add3 , driver )
306+ elif reg == 'US' :
307+ state = Select (driver .find_element_by_name ("order[billing_state]" ))
308+ selectText (paydetails ['Addr3' ], state , True )
293309
294310 city = check_exists_by_xpath ("""//*[@id="order_billing_city"]""" , driver )
295311 sendKeys (paydetails ['City' ], city , driver )
296312
297313 postcode = check_exists_by_xpath ("""//*[@id="order_billing_zip"]""" , driver )
298314 sendKeys (paydetails ['Post/zip code' ], postcode , driver )
299315
300- country = Select (driver .find_element_by_name ("order[billing_country]" ))
301- selectText (paydetails ['Country' ], country , True )
316+ if reg == 'EU' :
317+ cardType = Select (driver .find_element_by_id ("credit_card_type" ))
318+ selectText (paydetails ['CardType' ].lower (), cardType , True )
302319
303- if paydetails ['CardType' ] != 1 :
304- cardno = check_exists_by_xpath ("""//*[@id="cnb"]""" , driver )
320+ if paydetails ['CardType' ].lower () != 'paypal' :
321+ if reg == 'EU' :
322+ cardno = check_exists_by_xpath ("""//*[@id="cnb"]""" , driver )
323+ elif reg == 'US' :
324+ cardno = check_exists_by_xpath ("""//*[@id="nnaerb"]""" , driver )
305325 sendKeys (paydetails ['Cardno' ], cardno , driver )
306326
307- cvv = check_exists_by_xpath ("""//*[@id="vval"]""" , driver )
327+ if reg == 'EU' :
328+ cvv = check_exists_by_xpath ("""//*[@id="vval"]""" , driver )
329+ elif reg == 'US' :
330+ cvv = check_exists_by_xpath ("""//*[@id="orcer"]""" , driver )
308331 sendKeys (paydetails ['CardCVV' ], cvv , driver )
309332
310- cardType = Select (driver .find_element_by_id ("credit_card_type" ))
311- selectText (paydetails ['CardType' ], cardType )
312-
313333 expiraryDate1 = Select (driver .find_element_by_name ("credit_card[month]" ))
314- selectText (paydetails ['CardMonth' ], expiraryDate1 )
334+ selectText (paydetails ['CardMonth' ], expiraryDate1 , True )
315335
316336 expiraryDate2 = Select (driver .find_element_by_name ("credit_card[year]" ))
317- selectText (paydetails ['CardYear' ], expiraryDate2 )
337+ selectText (paydetails ['CardYear' ], expiraryDate2 , True )
318338
319339 tickBox = driver .find_element_by_xpath ("""//*[@id="cart-cc"]/fieldset/p/label/div/ins""" )
320340 tickBox .click ()
321341
322342 complete = check_exists_by_xpath ("""//*[@id="pay"]/input""" , driver )
323- complete .click ()
343+ # complete.click()
324344 print ("Complete the captcha and confirm the order manually. Thanks for using me ;)" )
325345 print ("If this bot helped you make money/cop a nice item, please consider donating to a charity of your choice" )
326346
@@ -347,11 +367,16 @@ def selectCategory():
347367
348368def getPDetails ():
349369 global password
370+ pp = False
350371 for x in paydetails :
351- if x in pDescr :
372+ if (reg == 'US' and x == 'CardType' ) or (pp and (x == 'Cardno' or x == 'CardCVV' or x == 'CardMonth' or x == 'CardYear' )):
373+ paydetails [x ] = 'Not Used'
374+ elif x in pDescr :
352375 paydetails [x ] = input ('Enter %s %s: ' % (x , pDescr [x ]))
353376 else :
354377 paydetails [x ] = input ('Enter %s: ' % (x ))
378+ if reg == 'EU' and paydetails ['CardType' ].lower () == 'paypal' :
379+ pp = True
355380
356381 inp = input ('\n \n Do you want to safe your details encrypted for easy future use? [Y]es/[N]o: ' )
357382 if inp .upper () == 'YES' or inp .upper () == 'Y' :
@@ -389,11 +414,15 @@ def selectItemNum():
389414def getItemDetails ():
390415 global items , selectedCategory
391416 while True :
392- selectedCategory = selectCategory ()
393- keywords = selectKeywords ()
417+ #selectedCategory = selectCategory()
418+ selectedCategory = 'jackets'
419+ #keywords = selectKeywords()
420+ keywords = ['World' , 'Famous' ]
394421
395- selectedSize = selectSize ()
396- selectedColour = selectColour ()
422+ #selectedSize = selectSize()
423+ selectedSize = 'D'
424+ #selectedColour = selectColour()
425+ selectedColour = 'Green'
397426
398427 listOptions (selectedCategory , ',' .join (keywords ), selectedSize , selectedColour )
399428 answer = input ("Are you sure about these settings? [Y]es/[N]o: " ).upper ()
@@ -403,9 +432,18 @@ def getItemDetails():
403432 items .append ({'selectedCategory' : selectedCategory , 'keywords' : keywords , 'selectedSize' : selectedSize , 'selectedColour' : selectedColour })
404433
405434
435+ def getRegion ():
436+ inp = input ('Enter region (EU or US): ' )
437+ if inp .upper () == 'EU' :
438+ return 'EU'
439+ elif inp .upper () == 'US' :
440+ return 'US'
441+ else :
442+ return getRegion ()
443+
406444
407445def main ():
408- global service , capabilities , password , items
446+ global service , capabilities , password , items , reg , pDescr
409447 wsh = comclt .Dispatch ("WScript.Shell" )
410448 chromePath = readPath ()
411449
@@ -421,12 +459,20 @@ def main():
421459 print (
422460 "\n Fill out all the details, make sure you get all of them right. If you need help please open 'README.md' or check the reddit post." )
423461
462+ reg = getRegion ()
463+
464+ if reg == 'EU' :
465+ pDescr = EUpDescr
466+ elif reg == 'US' :
467+ pDescr = USpDescr
468+
424469 if not path .isfile (getLoc ('config.cnf' )):
425470 enc .paydetails = paydetails
426471 enc .initConf ()
427472 getPDetails ()
428473 else :
429474 inp = input ('Do you want to use your stored details? [Y]es/[N]o: ' )
475+ enc .update (paydetails )
430476 if inp .upper () == 'YES' or inp .upper () == 'Y' :
431477 inp = input ('Enter your password: ' )
432478 enc .password = inp .encode ('ascii' )
0 commit comments