Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jun 24, 2022

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from 1989shack June 24, 2022 22:27
@cnp-for-devops
Copy link

Authentication to CNP for DevOps failed. Click here to try again: https://portal.cwp.radwarecloud.com/github-plugin.html?installation_id=26169338&setup_action=install

@changelogg
Copy link

changelogg bot commented Jun 24, 2022

Hey! Changelogs info seems to be missing or might be in incorrect format.
Please use the below template in PR description to ensure Changelogg can detect your changes:
- (tag) changelog_text
or
- tag: changelog_text
OR
You can add tag in PR header or while doing a commit too
(tag) PR header
or
tag: PR header
Valid tags: added / feat, changed, deprecated, fixed / fix, removed, security, build, ci, chore, docs, perf, refactor, revert, style, test
Thanks!
For more info, check out changelogg docs

sys.exit(c.RED + "[!] Interrupt handler received, exiting..." + c.END)
sys.exit(f"{c.RED}[!] Interrupt handler received, exiting...{c.END}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ctrl_c refactored with the following changes:

print(c.YELLOW + ' _____ ')
print(f'{c.YELLOW} _____ ')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function banner refactored with the following changes:

Comment on lines -95 to +114
print(c.YELLOW + "[*] Found NS: {}".format(server) + c.END)
print(c.YELLOW + f"[*] Found NS: {server}" + c.END)
ip_answer = dns.resolver.resolve(server.target, 'A')
for ip in ip_answer:
print(c.YELLOW + "[*] IP for {} is {}".format(server, ip) + c.END)
print(c.YELLOW + f"[*] IP for {server} is {ip}" + c.END)
try:
zone = dns.zone.from_xfr(dns.query.xfr(str(ip), domain))
for host in zone:
print(c.YELLOW + "[" + c.END + c.GREEN + "+" + c.END + c.YELLOW + "] Found Host: {}".format(host) + c.END)
print(
f"{c.YELLOW}[{c.END}{c.GREEN}+{c.END}{c.YELLOW}"
+ f"] Found Host: {host}"
+ c.END
)

except Exception as e:
print(c.YELLOW + "[" + c.END + c.RED + "-" + c.END + c.YELLOW + "] NS {} refused zone transfer!".format(server) + c.END)
print(
f"{c.YELLOW}[{c.END}{c.RED}-{c.END}{c.YELLOW}"
+ f"] NS {server} refused zone transfer!"
+ c.END
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function axfr refactored with the following changes:

Comment on lines -112 to +122
r = requests.get("https://crt.sh/?q=" + domain + "&output=json", timeout=20)
r = requests.get(f"https://crt.sh/?q={domain}&output=json", timeout=20)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SDom refactored with the following changes:

@sourcery-ai
Copy link
Author

sourcery-ai bot commented Jun 24, 2022

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.11%.

Quality metrics Before After Change
Complexity 18.55 😞 18.55 😞 0.00
Method Length 97.00 🙂 97.91 🙂 0.91 👎
Working memory 7.92 🙂 7.82 🙂 -0.10 👍
Quality 55.44% 🙂 55.55% 🙂 0.11% 👍
Other metrics Before After Change
Lines 200 210 10
Changed files Quality Before Quality After Quality Change
SDomDiscover.py 55.44% 🙂 55.55% 🙂 0.11% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
SDomDiscover.py SDom 37 ⛔ 291 ⛔ 12 😞 23.09% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
SDomDiscover.py axfr 9 🙂 167 😞 9 🙂 54.49% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants