Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmacias95 authored Apr 22, 2024
1 parent e1a71cb commit 9515b0c
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions examples/file_provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,28 @@

async def get_provenance_info(apikey, file_hash):
async with vt.Client(apikey) as client:
file_obj = await client.get_object_async(f"/files/{file_hash}")
file_obj = await client.get_object_async(f'/files/{file_hash}')

return (
getattr(file_obj, "monitor_info", None),
getattr(file_obj, "nsrl_info", None),
getattr(file_obj, "signature_info", None),
getattr(file_obj, "tags", []),
getattr(file_obj, "trusted_verdict", None),
getattr(file_obj, 'monitor_info', None),
getattr(file_obj, 'nsrl_info', None),
getattr(file_obj, 'signature_info', None),
getattr(file_obj, 'tags', []),
getattr(file_obj, 'trusted_verdict', None),
)


async def main():
parser = argparse.ArgumentParser(
description="Get provenance info for a given file."
description='Get provenance info for a given file.'
)

parser.add_argument("--apikey", required=True, help="your VirusTotal API key")
parser.add_argument('--apikey', required=True, help='your VirusTotal API key')
parser.add_argument(
"--path",
'--path',
required=True,
type=argparse.FileType("rb"),
help="path to the file check.",
type=argparse.FileType('rb'),
help='path to the file check.',
)
args = parser.parse_args()

Expand All @@ -59,13 +59,13 @@ async def main():
args.apikey, file_hash
)
except vt.error.APIError as e:
print(f"ERROR: {e}")
print(f'ERROR: {e}')
sys.exit(1)

if monitor:
print(
"Present in monitor collections "
f"of {', '.join(monitor['organizations'])}"
'Present in monitor collections '
f'of {", ".join(monitor["organizations"])}'

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.
)

if nslr:
Expand All @@ -80,7 +80,7 @@ async def main():
print(f'Trusted file by {trusted["organization"]}')

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (secret)
as clear text.


if __name__ == "__main__":
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

0 comments on commit 9515b0c

Please sign in to comment.