Tags: misc 

Rating:

[link to original writeup](https://github.com/babaiserror/ctf/tree/main/%5B210723-27%5D%20ImaginaryCTF%202021#spelling-test-misc-100-pts)

Use a dictionary and diff library to go through the word list and diff.

`words.py`:
``` python
import enchant
import difflib

d = enchant.Dict("en_US")
typo = []
sugg = []
possible = ""

with open("words.txt", "r") as f:
line = f.readline().strip()
while line:
if not d.check(line) and not d.check(line.capitalize()):
typo.append(line)
suggestion = d.suggest(line)
sugg.append(suggestion[0])
for i,s in enumerate(difflib.ndiff(line,suggestion[0])):
if s[0] == '-': possible = possible+s[-1]
line = f.readline().strip()

print(typo)
print(sugg)
print(possible)
```
```
$ python3 words.py
['convirgence', 'translatcr', 'addretsing', 'javascript', 'approachfs', 'namespace', 'subscrybers', 'endangored', 'modufications', 'rehapilitation', 'camputers', 'mastercard', 'classisal', 'munisipality', 'engineereng', 'requiremend', 'generatint', 'recruitmeht', 'yorkshere', 'applicasions', 'instalping', 'changelog', 'broadcesting', 'attractlve', 'enquiries', 'obituarles', 'bibliogriphy', 'avainable', 'wordpress', 'instructiongl', 'strengthenint', 'discherge', 'playstation', 'subscriptisn', 'copyrightet']
['convergence', 'translator', 'addressing', 'java script', 'approaches', 'name space', 'subscribers', 'endangered', 'modifications', 'rehabilitation', 'computers', 'master card', 'classical', 'municipality', 'engineering', 'requirement', 'generating', 'recruitment', 'worksheet', 'applications', 'installing', 'change log', 'broadcasting', 'attractive', 'inquiries', 'obituaries', 'bibliography', 'available', 'word press', 'instructional', 'strengthening', 'discharge', 'play station', 'subscription', 'copyrighted']
ictfyoupassedthyrspelelingtest
```

Something seems off. Looking at the list, it seems that 'yorkshere' became 'worksheet', and 'enquiries' was incorrectly flagged as a typo; 'yorkshere' should become 'yorkshire', so in place of 'yr' should be an 'e'. An extra 'e' between the 'l's should not be there as well. Fixing those issues, we get: `ictfyoupassedthespellingtest`