<commit_before>import sys
import json
import pprint
import subprocess
import time

amountOfArgs = 6

if len(sys.argv) != amountOfArgs + 1:
    print("Exactly %s arguments needed. You provided the following %s:" % (amountOfArgs, len(sys.argv) - 1))
    for a in sys.argv:
        print("- " + a)
    print("Exiting.")
    sys.exit(2)

gitHubUserName = str(sys.argv[1])
accessToken = str(sys.argv[2])
repoToScan = str(sys.argv[3])
commitDepth = str(sys.argv[4])
whiteList = str(sys.argv[5])
breakOnSuspicious = int(sys.argv[6])

pathToLogs = 'log.json'

subprocess.call(["rm",pathToLogs])
gitRobProcess = subprocess.Popen([ "./gitrob", "-github-access-token", accessToken, "-commit-depth", commitDepth, "-save", pathToLogs, gitHubUserName], stdout=subprocess.PIPE)

print("Please wait for GitRob to finish scanning...")

gitRobRunning = True
byteOfKillWord = b'Ctrl+C'

#while gitRobRunning:
#    for line in gitRobProcess.stdout:
#        if byteOfKillWord in line:
#            gitRobRunning = False
#            gitRobProcess.kill()
#            break

for line in gitRobProcess.stdout:
    if byteOfKillWord in line:
        gitRobProcess.kill()
        break

with open(pathToLogs) as data_file:
    data_loaded = json.load(data_file)

pp = pprint.PrettyPrinter(indent=2)


class Colors:
    OK = '\033[92m'
    Warning = '\033[93m'
    Fail = '\033[91m'


anySuspicious = 0

if data_loaded['Findings'] != None:
    i = 1
    for finding in data_loaded['Findings']:
        if finding['RepositoryName'] == repoToScan:
            if finding['FilePath'].split('/')[-1] not in whiteList:
                anySuspicious = 1
                print(Colors.Warning + "\n##### Suspicious item #%s\n" % i)
                pp.pprint(finding)
                i = i + 1

if anySuspicious == 1:<commit_msg>added shell:True for bamboo agent permission issue<commit_after>import sys
import json
import pprint
import subprocess
import time

amountOfArgs = 6

if len(sys.argv) != amountOfArgs + 1:
    print("Exactly %s arguments needed. You provided the following %s:" % (amountOfArgs, len(sys.argv) - 1))
    for a in sys.argv:
        print("- " + a)
    print("Exiting.")
    sys.exit(2)

gitHubUserName = str(sys.argv[1])
accessToken = str(sys.argv[2])
repoToScan = str(sys.argv[3])
commitDepth = str(sys.argv[4])
whiteList = str(sys.argv[5])
breakOnSuspicious = int(sys.argv[6])

pathToLogs = 'log.json'

subprocess.call(["rm",pathToLogs])
gitRobProcess = subprocess.Popen([ "./gitrob", "-github-access-token", accessToken, "-commit-depth", commitDepth, "-save", pathToLogs, gitHubUserName], stdout=subprocess.PIPE, shell=True)

print("Please wait for GitRob to finish scanning...")

gitRobRunning = True
byteOfKillWord = b'Ctrl+C'

for line in gitRobProcess.stdout:
    if byteOfKillWord in line:
        gitRobProcess.kill()
        break

with open(pathToLogs) as data_file:
    data_loaded = json.load(data_file)

pp = pprint.PrettyPrinter(indent=2)


class Colors:
    OK = '\033[92m'
    Warning = '\033[93m'
    Fail = '\033[91m'


anySuspicious = 0

if data_loaded['Findings'] != None:
    i = 1
    for finding in data_loaded['Findings']:
        if finding['RepositoryName'] == repoToScan:
            if finding['FilePath'].split('/')[-1] not in whiteList:
                anySuspicious = 1
                print(Colors.Warning + "\n##### Suspicious item #%s\n" % i)
                pp.pprint(finding)
                i = i + 1

if anySuspicious == 1:
{'fraction_non_alphanumeric': 0.13756154068925572, 'fraction_numerical': 0.01853460758760498, 'mean_word_length': 3.191747572815534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1736553', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1162, 'n_words': 286}