can anyone adjust this python script to run a set amount range on a specific serial and then move on to the next serial and do the same after printing the result ?
import requests
import os
try:
from anticaptchaofficial.recaptchav2proxyless import *
except:
os.system('python3 -m pip install anticaptchaofficial')
from anticaptchaofficial.recaptchav2proxyless import *
def get_g_response():
g_response = 0
solver = recaptchaV2Proxyless()
solver.set_verbose(0)
solver.set_key("79f5448cc70e9409b8c634134d2e1db3")
solver.set_website_url("https://tcvs.fiscal.treasury.gov/")
solver.set_website_key("6LdJmKEaAAAAAJ6A6SvD09PyyJAAFtYUQHb277lh")
#set optional custom parameter which Google made for their search page Recaptcha v2
#solver.set_data_s('"data-s" token from Google Search results "protection"')
solver.set_soft_id(0)
g_response = solver.solve_and_return_solution()
if g_response != 0:
return g_response
else:
print('failed getting response')
return False
def check_serial(serial, Date,Amount):
amount=
s=str(serial)
a= s
n=1
c = int(a) % int(n)
ck_digit= c
#amount=amount
date='2022-' + str(Date)
for x in amount:
print('CHECK #: ' + str(serial) + '['+ str(ck_digit) + ']' + 'AMOUNT' + x + ' ISSUE DATE: ' + str(date))
g_response = get_g_response()
if g_response:
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://tcvs.fiscal.treasury.gov/',
'RecaptchaResponse': g_response,
'Connection': 'keep-alive',
# 'Cookie': 'TS0130273e=01f6e3b1e9de21a8bcbd805770e36f4fa256723cfe7cc999222e0d0374d0e0e887d487e8e08d20feb9d01a92639252651aa9cf9742',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin'}
cookies = {
'TS0130273e': '01f6e3b1e9de21a8bcbd805770e36f4fa256723cfe7cc999222e0d0374d0e0e887d487e8e08d20feb9d01a92639252651aa9cf9742',
}
params = {
'symbol_number': '4045',
'serial_number': str(serial),
'amount': amount,
'bank_rtn': '000000518',
'issue_date': str(date),
}
response = requests.get('https://tcvs.fiscal.treasury.gov/api/anon/validate', params=params, cookies=cookies, headers=headers)
r=response.text
print('RESULT = ' + str(r))
print('--------------------------------------------------------------------')
Paid = ('P') in r
Issued = ('I') in r
Null = ('null') in r
Cancelled = ('C') in r
ser=(str(serial))
c_file=open("checked.txt", 'r')
read_file = c_file. read()
if ser in read_file:
pass
elif ser not in read_file:
with open('checked.txt', 'a+') as checked_file:
checked_file.write(str(serial) + 'AMOUNT' + '\n' + str(date))
c_file.close()
if Null == True:
with open('NO_MATCH.txt', 'a+') as nomatch_file:
nomatch_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | IS NO MATCH FOR AMOUNT: ' + x + ' \n')
elif Paid == True:
with open('paid.txt', 'a+') as paid_file:
paid_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | ' + x[0:4] + ' | ' + str(date) + ' | PAID' + '\n')
break
elif Issued == True:
with open('Issued.txt', 'a+') as issued_file:
issued_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | ' + x[0:4] + ' | ' + str(date) + ' | ISSUED' + '\n')
break
elif Cancelled == True:
with open('cancelled.txt', 'a+') as cancelled_file:
cancelled_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | ' + str((r[18:31])) + '\n')
break
from time import sleep, perf_counter
import queue
import os
def run1():
file_exists = os.path.isfile('checked.txt')
if file_exists == False:
print('ENTER A SERIAL NUMBER TO CREATE FILE--ONLY NEED TO DO FOR 1ST TIME')
s= input('INPUT HERE: ' + ' → ')
print(' ')
print('ENTER DATE FOR ABOVE SERIAL: (MM-DD FORMAT) ' + ' FOR EXAMPLE: 10-18')
d= input('INPUT HERE: ' + '→ ')
print(' ')
with open('checked.txt', 'x') as checked_file:
checked_file.write(str(s) + ' | 2022-' + str(d) + '\n')
run1()
if file_exists == True:
f1 = open('checked.txt', 'r')
last_line = f1.readlines()[-1]
f1.close()
print(' ')
print('ENTER AMOUNTS BY 2 DIGITS ONLY------SEPERATE AMOUNTS BY COMMA')
print(' ')
Amounts = input('EXAMPLE: 14,28,42, etc. ' + '\n' + '→→')
amounts = Amounts.split(",")
List1 = amounts
string = ""
amount = list(map(lambda x:"{}{}".format(x, string), List1))
print(' ')
print('LAST NUMBER TO BE CHECKED WAS: ' + '\n' + '→→'+ last_line[0:8])
print(' ')
print('DO YOU WANT TO CONTINUE FROM THIS NUMBER?:' +'\n')
print(' ')
cont=input('YES OR NO? (CAN ENTER Y OR N):').lower()
print(' ')
if cont.startswith('n') == True:
serial_nm = (input('ENTER 8-DIGIT SERIAL # : ' + '\n'))
print('-----------------------------------------------------------------')
print(' ')
print('ENTER ISSUE DATE '+ ' (MM-DD FORMAT): ')
print(' ')
Date = input('EXAMPLE (10-18): ' + '\n' + '→→')
print(' ')
print('-----------------------------------------------------------------')
print(' ')
serial=serial_nm
elif cont.startswith('y') == True:
serial_nm = (last_line[0:8])
Date = (last_line[16:21])
serials=serial_nm
serial= (str(int(serials)+1))
print('-----------------------------------------------------------------')
print('ARE THESE ALL CORRECT?: ' )
print(' ')
print('SERIAL# = '+str(serial))
print(' ')
print('ISSUE DATE = 2022-'+str(Date))
print(' ')
print('AMOUNTS = ' +str(amount))
print(' ')
print('YES OR NO?')
print(' ')
Answer=input('TYPE Y OR N: ').lower()
print(' ')
print('-----------------------------------------------------------------')
print(' ')
q=queue.Queue()
if Answer.startswith('y') == True:
print(' ')
print('---------NOW CHECKING----------')
print('--NUMBER IN [ ] AFTER SERIAL NUMBER IS CHECK DIGIT--')
print(' ')
[q.put(str(int(serial)+x)) for x in range(500)]
for me in range(500):
serial=q.get()
check_serial(str(serial),str(Date),amount)
try:
driver.quit()
except:
pass
elif Answer.startswith('n') == True:
print('PLEASE RE-ENTER AND TRY AGAIN')
run1()
run1()
import requests
import os
try:
from anticaptchaofficial.recaptchav2proxyless import *
except:
os.system('python3 -m pip install anticaptchaofficial')
from anticaptchaofficial.recaptchav2proxyless import *
def get_g_response():
g_response = 0
solver = recaptchaV2Proxyless()
solver.set_verbose(0)
solver.set_key("79f5448cc70e9409b8c634134d2e1db3")
solver.set_website_url("https://tcvs.fiscal.treasury.gov/")
solver.set_website_key("6LdJmKEaAAAAAJ6A6SvD09PyyJAAFtYUQHb277lh")
#set optional custom parameter which Google made for their search page Recaptcha v2
#solver.set_data_s('"data-s" token from Google Search results "protection"')
solver.set_soft_id(0)
g_response = solver.solve_and_return_solution()
if g_response != 0:
return g_response
else:
print('failed getting response')
return False
def check_serial(serial, Date,Amount):
amount=
s=str(serial)
a= s
n=1
c = int(a) % int(n)
ck_digit= c
#amount=amount
date='2022-' + str(Date)
for x in amount:
print('CHECK #: ' + str(serial) + '['+ str(ck_digit) + ']' + 'AMOUNT' + x + ' ISSUE DATE: ' + str(date))
g_response = get_g_response()
if g_response:
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://tcvs.fiscal.treasury.gov/',
'RecaptchaResponse': g_response,
'Connection': 'keep-alive',
# 'Cookie': 'TS0130273e=01f6e3b1e9de21a8bcbd805770e36f4fa256723cfe7cc999222e0d0374d0e0e887d487e8e08d20feb9d01a92639252651aa9cf9742',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin'}
cookies = {
'TS0130273e': '01f6e3b1e9de21a8bcbd805770e36f4fa256723cfe7cc999222e0d0374d0e0e887d487e8e08d20feb9d01a92639252651aa9cf9742',
}
params = {
'symbol_number': '4045',
'serial_number': str(serial),
'amount': amount,
'bank_rtn': '000000518',
'issue_date': str(date),
}
response = requests.get('https://tcvs.fiscal.treasury.gov/api/anon/validate', params=params, cookies=cookies, headers=headers)
r=response.text
print('RESULT = ' + str(r))
print('--------------------------------------------------------------------')
Paid = ('P') in r
Issued = ('I') in r
Null = ('null') in r
Cancelled = ('C') in r
ser=(str(serial))
c_file=open("checked.txt", 'r')
read_file = c_file. read()
if ser in read_file:
pass
elif ser not in read_file:
with open('checked.txt', 'a+') as checked_file:
checked_file.write(str(serial) + 'AMOUNT' + '\n' + str(date))
c_file.close()
if Null == True:
with open('NO_MATCH.txt', 'a+') as nomatch_file:
nomatch_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | IS NO MATCH FOR AMOUNT: ' + x + ' \n')
elif Paid == True:
with open('paid.txt', 'a+') as paid_file:
paid_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | ' + x[0:4] + ' | ' + str(date) + ' | PAID' + '\n')
break
elif Issued == True:
with open('Issued.txt', 'a+') as issued_file:
issued_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | ' + x[0:4] + ' | ' + str(date) + ' | ISSUED' + '\n')
break
elif Cancelled == True:
with open('cancelled.txt', 'a+') as cancelled_file:
cancelled_file.write(str(serial) + '['+ str(ck_digit) + ']' + ' | ' + str((r[18:31])) + '\n')
break
from time import sleep, perf_counter
import queue
import os
def run1():
file_exists = os.path.isfile('checked.txt')
if file_exists == False:
print('ENTER A SERIAL NUMBER TO CREATE FILE--ONLY NEED TO DO FOR 1ST TIME')
s= input('INPUT HERE: ' + ' → ')
print(' ')
print('ENTER DATE FOR ABOVE SERIAL: (MM-DD FORMAT) ' + ' FOR EXAMPLE: 10-18')
d= input('INPUT HERE: ' + '→ ')
print(' ')
with open('checked.txt', 'x') as checked_file:
checked_file.write(str(s) + ' | 2022-' + str(d) + '\n')
run1()
if file_exists == True:
f1 = open('checked.txt', 'r')
last_line = f1.readlines()[-1]
f1.close()
print(' ')
print('ENTER AMOUNTS BY 2 DIGITS ONLY------SEPERATE AMOUNTS BY COMMA')
print(' ')
Amounts = input('EXAMPLE: 14,28,42, etc. ' + '\n' + '→→')
amounts = Amounts.split(",")
List1 = amounts
string = ""
amount = list(map(lambda x:"{}{}".format(x, string), List1))
print(' ')
print('LAST NUMBER TO BE CHECKED WAS: ' + '\n' + '→→'+ last_line[0:8])
print(' ')
print('DO YOU WANT TO CONTINUE FROM THIS NUMBER?:' +'\n')
print(' ')
cont=input('YES OR NO? (CAN ENTER Y OR N):').lower()
print(' ')
if cont.startswith('n') == True:
serial_nm = (input('ENTER 8-DIGIT SERIAL # : ' + '\n'))
print('-----------------------------------------------------------------')
print(' ')
print('ENTER ISSUE DATE '+ ' (MM-DD FORMAT): ')
print(' ')
Date = input('EXAMPLE (10-18): ' + '\n' + '→→')
print(' ')
print('-----------------------------------------------------------------')
print(' ')
serial=serial_nm
elif cont.startswith('y') == True:
serial_nm = (last_line[0:8])
Date = (last_line[16:21])
serials=serial_nm
serial= (str(int(serials)+1))
print('-----------------------------------------------------------------')
print('ARE THESE ALL CORRECT?: ' )
print(' ')
print('SERIAL# = '+str(serial))
print(' ')
print('ISSUE DATE = 2022-'+str(Date))
print(' ')
print('AMOUNTS = ' +str(amount))
print(' ')
print('YES OR NO?')
print(' ')
Answer=input('TYPE Y OR N: ').lower()
print(' ')
print('-----------------------------------------------------------------')
print(' ')
q=queue.Queue()
if Answer.startswith('y') == True:
print(' ')
print('---------NOW CHECKING----------')
print('--NUMBER IN [ ] AFTER SERIAL NUMBER IS CHECK DIGIT--')
print(' ')
[q.put(str(int(serial)+x)) for x in range(500)]
for me in range(500):
serial=q.get()
check_serial(str(serial),str(Date),amount)
try:
driver.quit()
except:
pass
elif Answer.startswith('n') == True:
print('PLEASE RE-ENTER AND TRY AGAIN')
run1()
run1()