Permutation engine for generating and checking the availability of malicious Twitter usernames. Several edit operations are supported: substitution, transposition, insertion, deletion, and prefix/suffix. Inspired by dnstwist.
- Python 3
git clone https://github.com/mh0x/twister.git
usage: twister.py [-h] [-c] [-q] [-o OUTPUT] [-n THREADS]
[-r RETRIES] [-t TIMEOUT] profile user [user ...]
positional arguments:
profile generator profile json
user target username(s)
optional arguments:
-h, --help show this help message and exit
-c, --check check availability of generated usernames
-q, --quiet suppress messages sent to stdout
-o OUTPUT, --output OUTPUT output results to csv file
-n THREADS, --threads THREADS max concurrent requests (default: 5)
-r RETRIES, --retries RETRIES max request retries (default: 2)
-t TIMEOUT, --timeout TIMEOUT request timeout, secs (default: 10)
edit operations: notation:
{"sub": {x: [y, ...], ...}, "max": n} x, y characters
{"tra": [[x, y], ...], "max": n} u strings
{"ins": {x: [y, ...], ...}, "max": n} n positive integers
{"del": [x, ...], "max": n}
{"pre": [u, ...]}
{"suf": [u, ...]}
A generator profile is a JSON description of a pipeline of edit operations:
[
o1,
o2,
o3,
... on]
The output of o1 passed to o2, whose output is passed to o3, and so on to on.
Supported edit operations are described below using the following notation:
- ‘x’ and ‘y’ range over characters;
- ‘u’ and ‘v’ range over strings;
- ‘n’ ranges over positive integers;
- asterisks denote Kleene star (ignoring comma separators).
Note: Operations that perform single-character edits have a max
property
that specifies their maximum edit distance.
{"sub":{
("
x":[
("
y"
)*]
)*},"max":
n}
{"tra":[
(["
x","
y"]
)*],"max":
n}
{"ins":{
("
x":[
("
y"
)*]
)*},"max":
n}
{"del":[
("
x"
)*],"max":
n}
{"pre":[
("
v"
)*]}
{"suf":[
("
v"
)*]}
Some examples of individual edit operations are provided in ops/:
- Common Deletions (taken from [1])
- Common Transpositions (taken from [1])
- Company Suffixes (taken from [2])
- Double Hits
- Fat Fingers
- Homoglyphs (taken from [3])
- Language Code Suffixes (taken from [4])
- Mishits
Note: max
values are provisionally set to 1
.
The profile
argument accepts a JSON string or a path to a JSON file. The
latter option is useful for specifying complex profiles. Alternatively,
individual edit operations may be saved (cf.
ops/)
and composed on the command line:
twister.py [args ...] <<< echo "[$(cat op1.json), $(cat op2.json), ...]" user [user ...]
Twitter usernames are case-insensitive strings of 1–15 characters (a
–z
,
A
–Z
, 0
–9
, _
)
[5]. Hence, user
and profile
arguments are converted to lower-case.
The -o/--output
option outputs the results to a given file, in CSV format.
The first column contains generated usernames. If the -c/--check
option is
specified, there is a second column that contains their availability status
(1
available, 0
unavailable, -1
error).
-
Sloppy Typing
https://datagenetics.com/blog/november42012/index.html -
Copmany Suffixes
https://www.harborcompliance.com/information/company-suffixes -
List of Visually Similar Characters for Detecting Spoofing and Social Engineering Attacks
https://security.stackexchange.com/a/128463 -
ISO 639.2: Codes for the Representation of Names of Languages
https://www.loc.gov/standards/iso639-2/php/code_list.php -
Help with Username Registration
https://help.twitter.com/en/managing-your-account/twitter-username-rules
MIT © 2018 mh0x
Taken from MIT License:
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.