-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved key string. Typo fix + added installation guide in readme
- Loading branch information
1 parent
eba8274
commit 7da8bd0
Showing
3 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Wpkeygen.pyc | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
import sublime, sublime_plugin, hashlib, random | ||
import sublime, sublime_plugin, random, string, os | ||
|
||
class WpkeygenCommand(sublime_plugin.TextCommand): | ||
|
||
def run(self, edit): | ||
ListReplacements = [] | ||
Hasher = hashlib.sha1() | ||
def run(self, edit): | ||
ListReplacements = [] | ||
|
||
RegionsResult = self.view.find_all(r"(define\(')([A-Z_]+)(_)(KEY|SALT)(',)(.*?)(\);)", sublime.IGNORECASE, "\\1\\2\\3\\4\\5'THISBITSHOLDBEREPLACED'\\7", ListReplacements) | ||
|
||
for i, thisregion in reversed(list(enumerate(RegionsResult))): | ||
newsalt = ListReplacements[i].replace('THISBITSHOLDBEREPLACED', self.rsv()) | ||
self.view.replace(edit, thisregion, newsalt) | ||
|
||
def rsv(self): | ||
length = 64 | ||
chars = string.ascii_letters + string.digits + '!@#$%^&*()`|_}-&><#{=.][;:+/' | ||
random.seed = (os.urandom(1024)) | ||
return ''.join(random.choice(chars) for i in range(length)) | ||
|
||
|
||
|
||
RegionsResult = self.view.find_all(r"(define\(')([A-Z_]+)(_)(KEY|SALT)(',)(.*?)(\);)", sublime.IGNORECASE, "\\1\\2\\3\\4\\5'THISBITSHOLDBEREPLACED'\\7", ListReplacements) | ||
|
||
for i, thisregion in reversed(list(enumerate(RegionsResult))): | ||
hashstring = "%032x" % random.getrandbits(128) | ||
Hasher.update(hashstring.encode('utf-8')) | ||
newsalt = ListReplacements[i].replace('THISBITSHOLDBEREPLACED', Hasher.hexdigest()) | ||
self.view.replace(edit, thisregion, newsalt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters