Skip to content

Instantly share code, notes, and snippets.

@tjarrettveracode
Created October 23, 2020 14:43
Show Gist options
  • Select an option

  • Save tjarrettveracode/4aae4fd101c82f0de07c04f16dfebbbb to your computer and use it in GitHub Desktop.

Select an option

Save tjarrettveracode/4aae4fd101c82f0de07c04f16dfebbbb to your computer and use it in GitHub Desktop.
Simple Python script to create a Veracode credentials file. Useful in environments like Pythonista.
import os
def create_folder(directory):
try:
if not os.path.exists(directory):
os.makedirs(directory)
except OSError:
print('Error: Creating directory. ' + directory)
#edit this to reflect your local Pythonista directory. You can try the following in a python console
# with StaSh to get an exception that will reveal the directory:
#from veracode_api_py import VeracodeAPI as vapi()
#user = vapi().get_user_self()
sysdir="/private/var/mobile/Containers/Shared/AppGroup/6D307C57-9FD3-41A4-B527-C08EA672FD4A/Pythonista3/.veracode"
create_folder(sysdir)
#edit this to add your actual Veracode API credentials - https://help.veracode.com/go/t_create_api_creds
api_id = "YOUR API ID HERE"
api_key = "YOUR API KEY HERE"
creds = sysdir+"/credentials"
f = open(creds,"a")
f.write("[default]\n")
f.write("veracode_api_key_id = "+ api_id + "\n")
f.write("veracode_api_key_secret = " + api_key + "\n")
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment