-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWpkeygen.py
More file actions
22 lines (13 loc) · 729 Bytes
/
Wpkeygen.py
File metadata and controls
22 lines (13 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sublime, sublime_plugin, random, string, os
class WpkeygenCommand(sublime_plugin.TextCommand):
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))