Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot commented May 11, 2022

Branch master 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 master branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from MediaPreneur May 11, 2022 09:47
temp = []
for key in self.cmdList:
temp.append((self.cmdList[key]['order'], key))
temp = [(self.cmdList[key]['order'], key) for key in self.cmdList]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function device.sortCommands refactored with the following changes:

Comment on lines -66 to +73
d = {}
d['UDID'] = self.UDID
if self.customName:
d['name'] = self.customName
else:
d['name'] = self.name
d['ip'] = self.IP
d['owner'] = self.owner
d['location'] = self.location
d['geo'] = self.GEO
d['status'] = ['success', 'warning', 'danger'][self.status]
d = {
'UDID': self.UDID,
'name': self.customName or self.name,
'ip': self.IP,
'owner': self.owner,
'location': self.location,
'geo': self.GEO,
'status': ['success', 'warning', 'danger'][self.status],
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function device.populate refactored with the following changes:

if self.status != 1:
return

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function device.checkTimeout refactored with the following changes:


# NOTE: Will need to overwrite this if behind a firewall
MY_ADDR = s.getsockname()[0] + ":8080"
MY_ADDR = f"{s.getsockname()[0]}:8080"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Lines 53-89 refactored with the following changes:

drop_list = []
for key in sorted(mdm_commands.iterkeys()):
drop_list.append([key, key])
drop_list = [[key, key] for key in sorted(mdm_commands.iterkeys())]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_commands.POST refactored with the following changes:

Comment on lines -585 to +583
problem_detect += ') Jailbreak detected for '
problem_detect += ') Jailbreak detected for '
problem_detect += web.ctx.ip

problems.insert(0, problem_detect)
out = "\nproblems = %s" % problems
fd = open('problems.py', 'w')
fd.write(out)
fd.close()
with open('problems.py', 'w') as fd:
fd.write(out)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function do_problem.GET refactored with the following changes:

Comment on lines -597 to +592
if 'CA.crt' in os.listdir('.'):
web.header('Content-Type', 'application/octet-stream;charset=utf-8')
web.header('Content-Disposition', 'attachment;filename="CA.crt"')
return open('CA.crt', "rb").read()
else:
if 'CA.crt' not in os.listdir('.'):
raise web.notfound()
web.header('Content-Type', 'application/octet-stream;charset=utf-8')
web.header('Content-Disposition', 'attachment;filename="CA.crt"')
return open('CA.crt', "rb").read()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function mdm_ca.GET refactored with the following changes:

Comment on lines -620 to +613
if 'Manifest.plist' in os.listdir('.'):
web.header('Content-Type', 'text/xml;charset=utf-8')
return open('Manifest.plist', "rb").read()
else:
if 'Manifest.plist' not in os.listdir('.'):
raise web.notfound()
web.header('Content-Type', 'text/xml;charset=utf-8')
return open('Manifest.plist', "rb").read()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function app_manifest.GET refactored with the following changes:

Comment on lines -630 to +623
if 'MyApp.ipa' in os.listdir('.'):
web.header('Content-Type', 'application/octet-stream;charset=utf-8')
web.header('Content-Disposition', 'attachment;filename="MyApp.ipa"')
return open('MyApp.ipa', "rb").read()
else:
if 'MyApp.ipa' not in os.listdir('.'):
return web.ok
web.header('Content-Type', 'application/octet-stream;charset=utf-8')
web.header('Content-Disposition', 'attachment;filename="MyApp.ipa"')
return open('MyApp.ipa', "rb").read()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function app_ipa.GET refactored with the following changes:

Comment on lines -639 to +629
fd = open(LOGFILE, "a")
fd.write(datetime.now().ctime())
fd.write(" %s\n" % repr(out))
fd.close()
with open(LOGFILE, "a") as fd:
fd.write(datetime.now().ctime())
fd.write(" %s\n" % repr(out))
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function log_data 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