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 Aug 23, 2023

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 bd0n4lds August 23, 2023 12:38
Comment on lines -32 to +45

if args.runTeams and args.teamsToken == '':
print("[!] Teams Bearer Token required for Teams enumeration, Exiting...")
sys.exit()

if args.teamsLegacy and args.outputfile == '':
print("[!] Teams Legacy Output requires the output file option (-o). Exiting...")
sys.exit()

inputNames = []
nameList = []
validNames = []
legacyNames = []

for name in args.inputList.readlines():
inputNames.append(name)
inputNames = list(args.inputList.readlines())
Copy link
Author

Choose a reason for hiding this comment

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

Lines 32-47 refactored with the following changes:

Comment on lines -85 to +108
print("[V] " + str(e))
print(f"[V] {str(e)}")
sys.exit()

if args.verboseMode:
print("[V] Using target tenant %s" % targetTenant)
print(f"[V] Using target tenant {targetTenant}")

for potentialUser in nameList:
try:
testURL = "https://" + targetTenant + "-my.sharepoint.com/personal/" + str(potentialUser.replace(".","_")) + "_" + str(args.targetDomain.replace(".","_")) + "/_layouts/15/onedrive.aspx"
testURL = (
f"https://{targetTenant}-my.sharepoint.com/personal/"
+ str(potentialUser.replace(".", "_"))
+ "_"
+ str(args.targetDomain.replace(".", "_"))
+ "/_layouts/15/onedrive.aspx"
)
if args.verboseMode:
print("[V] Testing: " + str(testURL))
print(f"[V] Testing: {str(testURL)}")
userRequest = requests.get(testURL, verify=False)
if userRequest.status_code in [200, 401, 403, 302]:
print("[+] " + str(str(potentialUser) + "@" + str(args.targetDomain)))
if userRequest.status_code in {200, 401, 403, 302}:
print(f'[+] {str(f"{str(potentialUser)}@{str(args.targetDomain)}")}')
validNames.append(str(potentialUser))
else:
if args.verboseMode:
print("[-] " + str(str(potentialUser) + "@" + str(args.targetDomain)))
pass

elif args.verboseMode:
print(f'[-] {str(f"{str(potentialUser)}@{str(args.targetDomain)}")}')
except Exception as e:
if args.verboseMode:
print("[V] " + str(e))
pass
print(f"[V] {str(e)}")
Copy link
Author

Choose a reason for hiding this comment

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

Function OneDriveEnumerator refactored with the following changes:

print("[V] Testing user %s" % potentialUserNameTeams)
print(f"[V] Testing user {potentialUserNameTeams}")
Copy link
Author

Choose a reason for hiding this comment

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

Function teamsEnum refactored with the following changes:

Comment on lines -157 to +159
global nameList
global nameList
for name in inputNames:
if "@" in name:
name = name.split("@")[0]
nameList.append(name.strip())
else:
nameList.append(name.strip())
nameList.append(name.strip())
Copy link
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

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