MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / doIt

Function doIt

scripts/passwordGenerator.js:123–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121 }
122
123 function doIt() {
124 var master = prompt(
125 "Tạo mật khẩu cho trang web bất kỳ từ duy nhất 1 Mật_khẩu_Chính\n" +
126 " + Nhập vào Mật_khẩu_Chính, trả về cho bạn mật khẩu cho web hiện tại\n" +
127 " + Không còn phải nhớ nhiều mật khẩu\n" +
128 " + Tự động điền vào trang web khi nhập đúng Mật_khẩu_Chính\n" +
129 "\nNhập Mật_khẩu_Chính của bạn:"
130 );
131 let host, sld, domain, D;
132 if (master != "" && master != null) {
133 host = document.location.href.match(/http(s*):\/\/([^/]+)/)[2];
134 if (
135 (sld = host.match(
136 /([^.]+\.([a-z][a-z][a-z]+|a[^abhjkpvy]|b[^cdklnpqux]|c[^bejkpqsty]|d[ejkmoz]|e[cegsu]|f[imor]|g[^cjkouvxz]|h[kmnrtu]|i[demnoqrst]|j[eop]|k[gimnpryz]|l[abcikrstuvy]|m[^bfijmz]|n[acefgloru]|om|p[aefhklmnrstwy]|qa|r[eosuw]|s[^fpqsw]|t[^abeiqrsuxy]|u[agsyz]|v[aceginu]|w[fs]|yt))$/i
137 ))
138 ) {
139 domain = sld[0];
140 } else {
141 domain = host.match(/([^.]+\.[^.]+\.[a-z][a-z])$/i)[0];
142 }
143 var i = 0,
144 j = 0,
145 p = b64_sha1(master + ":" + domain).substr(0, 13) + "@1a",
146 E = document.getElementsByTagName("input"),
147 g = false;
148 for (j = 0; j < E.length; j++) {
149 D = E[j];
150 if (D.type == "password") {
151 D.value = p;
152 D.focus();
153 g = true;
154 }
155 if (D.type == "text") {
156 if (
157 D.name.toUpperCase().indexOf("PASSWORD") != -1 ||
158 D.name.toUpperCase().indexOf("PASSWD") != -1
159 ) {
160 D.value = p;
161 D.focus();
162 g = true;
163 }
164 }
165 }
166 if (!g) {
167 prompt("Mật khẩu cho trang web " + domain + " là:", p);
168 }
169 }
170 }
171 doIt();
172 },
173 },

Callers 1

Calls 1

b64_sha1Function · 0.85

Tested by

no test coverage detected