Oct-16-2020, 07:23 PM
Hi all!
I have the script which I load into one program:
import requests
import sys
sourceip = sys.argv[1]
url = "https://www.example.com/vtapi/v2/ip-address/report?apikey=XXXXX&ip={0}".format(sourceip)
r = requests.get(url, verify=False)
print(r.text)
Because of
Everything works fine, but then the following…
I have this
curl -S -X POST -u username:pass -H 'Version: 12.1' -H 'Accept: application/json' 'https://prog.example2.com/api/reference_data/sets/virustotalIPs?value=TextIsHere'
When I convert it to Python (via online converter) I get:
import requests
headers = {
'Version': '12.1',
'Accept': 'application/json',
}
params = (
('value', 'TextIsHere'),
)
response = requests.post('https://prog.example2.com/api/reference_data/sets/virustotalIPs', headers=headers, params=params, auth=('username', 'pass'), verify=False)
And now, I have to add a module
It is necessary that instead of
How do i need to update the script to make it work?
Thanks All!
I have the script which I load into one program:
import requests
import sys
sourceip = sys.argv[1]
url = "https://www.example.com/vtapi/v2/ip-address/report?apikey=XXXXX&ip={0}".format(sourceip)
r = requests.get(url, verify=False)
print(r.text)
Because of
import sys
, the program substitutes its values instead of {0}
.Everything works fine, but then the following…
I have this
cURL
:curl -S -X POST -u username:pass -H 'Version: 12.1' -H 'Accept: application/json' 'https://prog.example2.com/api/reference_data/sets/virustotalIPs?value=TextIsHere'
When I convert it to Python (via online converter) I get:
import requests
headers = {
'Version': '12.1',
'Accept': 'application/json',
}
params = (
('value', 'TextIsHere'),
)
response = requests.post('https://prog.example2.com/api/reference_data/sets/virustotalIPs', headers=headers, params=params, auth=('username', 'pass'), verify=False)
And now, I have to add a module
import sys
to this script.It is necessary that instead of
TextIsHere
was {0}
. And don't forget to add .format(sourceip)
.How do i need to update the script to make it work?
Thanks All!