This function is used to call other functions to find secrets, cloud URLs etc. Parameters -------- file: list List contains all the content from different source to find secrets, cloud URLs etc. cloudlist: object Precompiled regex object to find cloud URLs.
(item_url, item_values, cloudlist, p, regex, ipv4reg, url)
| 502 | |
| 503 | |
| 504 | def getInfoFromData(item_url, item_values, cloudlist, p, regex, ipv4reg, url): |
| 505 | """ |
| 506 | |
| 507 | This function is used to call other functions to find secrets, cloud URLs etc. |
| 508 | |
| 509 | Parameters |
| 510 | -------- |
| 511 | file: list |
| 512 | List contains all the content from different source to find secrets, cloud URLs etc. |
| 513 | cloudlist: object |
| 514 | Precompiled regex object to find cloud URLs. |
| 515 | p: object |
| 516 | Precompiled regex object to find secret (high entropy strings) from content in the list. |
| 517 | regex: object |
| 518 | Precompiled regex object to find subdomains for a given domain. |
| 519 | ipv4reg: object |
| 520 | Precompiled regex object to find IP version 4 addresses within content. |
| 521 | url: str |
| 522 | Original URL from user provided input (URL argument). |
| 523 | """ |
| 524 | item_values = str(item_values).replace('\n', ' ') |
| 525 | |
| 526 | # cloud services |
| 527 | for x in cloudlist: |
| 528 | for item in x.findall(str(item_values)): |
| 529 | cloudurlset.add(item) |
| 530 | |
| 531 | matches = p.finditer(str(item_values)) |
| 532 | for matchNum, match in enumerate(matches): |
| 533 | if entropy(match.group(2)) > 3.5: |
| 534 | if item_url in secret_dict: |
| 535 | secret_dict[item_url].append(str(match.group())) |
| 536 | else: |
| 537 | secret_dict[item_url] = [str(match.group())] |
| 538 | |
| 539 | # try: |
| 540 | # st = file.split() |
| 541 | # for i in st: |
| 542 | # match = ipv4reg.search(i) |
| 543 | # if match: |
| 544 | # ipv4list.add(match.group()) |
| 545 | # except: |
| 546 | # pass |
| 547 | |
| 548 | # for subdomains |
| 549 | for subdomain in regex.findall(str(item_values)): |
| 550 | finalset.add(subdomain.lower()) |
| 551 | |
| 552 | # given domain regex |
| 553 | if args.domain: |
| 554 | domainreg = re.compile( |
| 555 | r'([a-zA-Z0-9][0-9a-zA-Z\-.]*[a-zA-Z0-9]\.' + args.domain + ')', re.IGNORECASE) |
| 556 | for subdomain in domainreg.findall(str(item_values)): |
| 557 | finalset.add(subdomain) |
| 558 | |
| 559 | |
| 560 | def getUrlsFromData(gitToken, domain): |