dpapathanasiou/tweet-secret: This is a text steganography ...

文章推薦指數: 80 %
投票人數:10人

This list of sentences is known as the set of eligible tweets. Messages are encoded by looking up each word token in a common dictionary, then using that ... Skiptocontent {{message}} dpapathanasiou / tweet-secret Public Notifications Fork 9 Star 183 ThisisatextsteganographyapplicationoptimizedforuseonTwitter,writteninClojure. MITLicense 183 stars 9 forks Star Notifications Code Issues 0 Pullrequests 0 Actions Projects 0 Wiki Security Insights More Code Issues Pullrequests Actions Projects Wiki Security Insights Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository. master Branches Tags Couldnotloadbranches Nothingtoshow {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default 1 branch 0 tags Code Latestcommit   Gitstats 25 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime src/tweet_secret     test/tweet_secret     .gitignore     LICENSE     README.md     config.properties     project.clj     Viewcode tweet-secret About BackgroundandMotivation HowItWorks Installation TestingtheInstallation Usage Configuration ExceptionsandWarnings Examples MultipleCorpusTexts(recommended) FutureTODO README.md tweet-secret About ThisisatextsteganographyapplicationoptimizedforuseonTwitter,writteninClojure. Thisisalsomyentryinthe2013LispinSummerProjectscontest. BackgroundandMotivation Twitteraccountsareeithercompletelyprivateorpublic;ifyouhaveapublicaccountandwanttotweetsomethingprivatelytoaselectlistofpeople,thereisnosimplewaytodoit. Twitterdoeshaveadirectmessagefeature,butithasseveraldrawbacks:youcanonlysendmessagestopeopleoneatatime,you'relimitedtopeoplewhofollowyouexplicitly,andworstofall,itmaybesubjectto3rdpartysnooping,governmentalorotherwise. HowItWorks Thetweet-secretapplicationisessentiallyabookcipher,usingplaintextfilesavailableontheweborcommonly-sharedamongagroupofpeopleasthe"book"orcorpustext.Thecorpus,whichconsistsofoneormoretexts,isknownonlyamongthesenderandintendedrecipients,andshouldbechangedfrequentlytopreventeavesdroppersfrompickingupthepatternormethod. Thecorpustextisparsedintoalistofsentences,filteredbycharacterlengthtoexcludeanythinglongerthan140charactersinsize.Thislistofsentencesisknownasthesetofeligibletweets. Messagesareencodedbylookingupeachwordtokeninacommondictionary,thenusingthatpointerreference(sequenceinoneormoredictionarylists)toasentenceinthesetofeligibletweetswhosepreceedingcumulativestringlengthmatchesthepointer.Thatsentencebecomesthetweettobebroadcast,tocorrespondtothewordtoken. Sincetheexactpointerpositionmaynotmatchthestartorendofacorpussentenceexactly,anunobtrusivemarkerisusedatthatpointinthetext(bydefaultaunicodemiddledotcharacter,whichcanbechangedintheconfig.propertiesfile),whichisimportantfordecoding. Tweetsaredecodedbyfindingtheirpositioninthesetofeligibletweets,countingthecumulativestringsizeuptothatpoint,andaddingtheamountoftheoffsetmarker,ifpresent.Theresultingnumberisthedictionarypointer,whichisusedtolookupthecorrespondingword. Installation GetandinstallLeiningenifyoudonotalreadyhaveit. Next,clonethisrepotoyourcomputer,gotothefolderwhereitexists,andrunthefollowingcommandsfromaterminal: $leindeps $leinuberjar Ifthebuildsucceeds,youshouldnowhaveajarfilecreatedintherepo'stargetfoldernamedtweet-secret-1.0-standalone.jar. TestingtheInstallation Therearetwotestcases,containingfourassertions,includedwhichtesttheencodinganddecodingofanEnglish-languagemessage,usingastaticcorpusfromgutenberg.org. Thedictionaryfortestingisre-boundtoastatic,universallyavailabledictionarytextfoundonline,sincethelinuxwordsfileasdefinedbydefaultinconfig.propertiescanvaryfromdistrotodistroandcomputertocomputer. Torunthetests,usethiscommand(youwillneedaninternetconnectiontohavethemrunsuccessfully,sinceboththecorpusanddictionarytextsusedinthetextsaredefinedasremoteURLs): $leintest Ifsuccessful,youshouldseethis: leintesttweet-secret.core-test Ran2testscontaining4assertions. 0failures,0errors. Usage Thecurrentversionworksviathecommandline.Usethe--helpswitchwheninvokingthestandalonejarfiletogetthelistofoptions: $java-jartweet-secret-1.0-standalone.jar--help tweet-secret:TextsteganographyoptimizedforTwitter SwitchesDefaultDesc ------------------- -c,--corpusREQUIRED:atleastoneurlorfullpathfilenameofthesecretcorpustext(s)knownonlybyyouandyourfriends -d,--decodeDecodethistweetintoplaintext(ifnonepresent,textafteralltheoptionswitcheswillbeencoded) -h,--no-help,--helpfalseShowthecommandlineusagehelp Configuration Theconfig.propertiesfiledefinesvarioussettingsusedbytheapplicationforbothencodinganddecoding: tweet-sizedefinesthemaximumtextsizeforanencodedtweettext. Thedefaultis140characterswhichistheconstraintimposedbyTwitter,butthiscanbeincreasedordecreasedifdesired.Notethatchangingittoanythingbutapositive,non-zerointegervaluewillresultinanerror. excess-markeristheunobtrusivemarkercharacterwithintheencodedtweettext. ItissetbydefaultastheUnicodeMiddleDot(Latin-1Supplement)character. dictionary-filesdefinesawhitespace-separatedlistoffilesorurlscontainingtextwordliststouseforthefirst-passofplaintextencoding. Itincludesboththe/usr/share/dict/wordslocalfile,whichisthedefaultforEnglishonmacosxandmostlinuxsystems,andhttp://www.cs.duke.edu/~ola/ap/linuxwordsanexampleofatextlistfoundonline. Wordsinmessagestobeencodedneedtoexistinatleastoneofthefilesorurlsdefinedhere,soifyourmessageusesspecializedlanguageorslang,you'llneedtohavetheappropriatedictionaryfile(s)definedhereaswell. corpus-parse-fndefinesthenameofthefunctioninthe/src/tweet-secret/languages.cljfiletouseforparsingthecorpustextintolistsofgrammaticallycorrectsentences. tokenize-fndefinesthenameofthefunctioninthe/src/tweet-secret/languages.cljfiletouseforsplittingtheinputmessageintoalistofdistincttokensthatareexpectedtobefoundinoneormoreofthedictionary-filespropertyvalues. ThedefaultisEnglish,butanylanguagecanbesupported,aslongastwofunctionsareimplementedinthe/src/tweet-secret/languages.cljfile. Afunctiontoparseastringintoalistofsentencestrings,and Afunctiontosplitamessagestringintowordtokens,whereeachtokenbeexpectedtobefoundinoneormoreofthedictionary-filespropertyvalues(asexplainedabove). Function(1)correspondstocorpus-parse-fnand(2)correspondstotokenize-fn. ExceptionsandWarnings Thetweet-sizevalueinconfig.propertiesmustbeapositive,non-zerointegervalue. The"-c"or"--corpus"commandlineargumentisrequired. Thisisthesecret"book"knownonlybyyouandthepeopleyouwanttobeabletounderstandyourmessage(seetheExamples,below,forsomeideasofwhattousehere). Thecorpustextneedstobelargeenoughsothatitcanparseenougheligibletweets(sentencesthataretweet-sizecharacterslongorless)sothatthenumberofeligibletweetsisgreaterthanorequaltothetotalnumberofwordsdefinedbythedictionary-filespropertyinconfig.properties,becausetheirrelativesizesandpositionsishowtheapplicationmapswordsinthemessagetocorrespondtocorpustweetstobroadcast. Thisisnotsomethingyouneedtocalculateinadvance,butthebestwaytoavoiditistousethelargesttextsyoucanaccess,andideallymorethanjustoneatatime,forsecurity(seetheExamples,below,forwhatthiswouldlooklike). Ifyoudowindupusingacorpustextwhichistoosmall,theapplicationwillgiveyouthiserrormessage: Sorry,yourcorpustextisnotlargeenough.Pleaseusealargertext,or,includeadditional--corpusoptionsandtryagain. Thewordsinthemessageyouwishtoencodemustexistinthecontentsofatleastoneofthedictionary-filesdefinedinconfig.properties. Toavoidthisproblem,addfilesorurlstothedictionary-filesvalueinconfig.propertieswhicharesuretocontainthewordsinyourmessage,otherwise,theapplicationwillgiveyouthiswarning: [WARNING]:"booyah"couldnotbeprocessed Ifyoutrytodecodeatweetwhichdoesnotexistamongthelistofeligibletweets(sentencesderivedfromparsingallthecorpustexts),youwillbegreetedwitha[WARNING]:"..."couldnotbeprocessedwarning. Examples Supposewewanttoencodethemessage"TonightwetakeParisbystorm"asaseriesofinnocuous-lookingtweets. Let'suseTheHistoryOfTheConquestOfMexico(http://textfiles.com/etext/NONFICTION/mexico)byWilliamHicklingPrescottontextfiles.comastherandomlyselectedcorpustext. Thecorpustextisknownonlybyusandthefollowerswewanttobeabletoreadthemessage.Thecorpustextshouldbechangedfrequently,andideally,nevereverusedmorethanonce.Itisalsoagoodideatousealistofseveralcorpustextsinpractice,sincethislessensthechancesthatsomeonespyingcouldguessthecorpusandbreakthecode(seebelow,afterthisfirstexample,forwhatthatlookslike). Openaterminal,gotothetargetfoldercontainingthestandalonejarfile,andtypethiscommand: $java-jartweet-secret-1.0-standalone.jar--corpushttp://textfiles.com/etext/NONFICTION/mexico\ "TonightwetakeParisbystorm" OnMacOSX,youshouldalsoinclude-Dfile.encoding=utf-8asacommandlineargumenttothejavainterpretersothatthetweetstringsareoutputcorrectly: $java-Dfile.encoding=utf-8-jartweet-secret-1.0-standalone.jar--corpushttp://textfiles.com/etext/NONFICTION/mexico\ "TonightwetakeParisbystorm" Thisresultsinthefollowingsixtweets,oneforeachwordoftheoriginalmessage: Onthefollowingmorning,thegener·alrequestedpermissiontoreturntheemperor'svisit,bywaitingonhiminhispalace. Apitchedbattlefollow·ed. ButtheprideofIztapalapan,onwhichitslordhadfreelyl·avishedhiscareandhisrevenues,wasitscelebratedgardens. Thisformofgovernm·ent,sodifferentfromthatofthesurroundingnations,subsistedtillthearrivaloftheSpaniards. TheMexica·nsfurnishnoexceptiontothisremark. He·felthisempiremeltingawaylikeamorningmist. Followerswhoknowthecorpustextcandecodethesetweetswiththiscommand: $java-jartweet-secret-1.0-standalone.jar--corpushttp://textfiles.com/etext/NONFICTION/mexico\ --decode"Onthefollowingmorning,thegener·alrequestedpermissiontoreturntheemperor'svisit,bywaitingonhiminhispalace."\ --decode"Apitchedbattlefollow·ed."\ --decode"ButtheprideofIztapalapan,onwhichitslordhadfreelyl·avishedhiscareandhisrevenues,wasitscelebratedgardens."\ --decode"Thisformofgovernm·ent,sodifferentfromthatofthesurroundingnations,subsistedtillthearrivaloftheSpaniards."\ --decode"TheMexica·nsfurnishnoexceptiontothisremark."\ --decode"He·felthisempiremeltingawaylikeamorningmist." Whichresultsinthislistofwords,correspondingtotheoriginalmessage: tonight we take Paris by storm MultipleCorpusTexts(recommended) Theencodingcanalsobedonewithmultiplecorpustexts,eitherallremoteurls,ormixingurlsandplaintextfilesavailableonyourcomputer'sfilesystem. Usingmultiplecorpustextsinsteadofjustasinglecorpustextishighlyrecommended,sinceitreducesthelikelihoodthatsomeoneattemptingtocrackyoursecretmessagediscoverstheunderlyingpattern.Italsohelpyouavoidthecorpustextisnotlargeenougherror. $java-jartweet-secret-1.0-standalone.jar--corpushttp://textfiles.com/humor/1988.hilite\ --corpus/home/guest/Downloads/random-text.txt\ --corpushttp://textfiles.com/humor/att.txt\ --corpushttp://textfiles.com/humor/contract.moo\ --corpushttp://www.gutenberg.org/cache/epub/1232/pg1232.txt\ --corpushttp://textfiles.com/humor/collected_quotes.txt\ --corpushttp://www.gutenberg.org/cache/epub/74/pg74.txt\ --corpus/home/guest/Downloads/english.txt\ --corpushttp://www.gutenberg.org/cache/epub/844/pg844.txt\ "TonightwetakeParisbystorm" Theonlycaveatwithusinglocalfilessuchastheseisthatyourfollowers(i.e.,peoplewhodecodethetweets)musthavethesameexactfilesontheircomputers. FutureTODO Comeupwithabetterstrategyforhandlingmessagewordswhicharenotdefinedinthedefaultdictionary-filestexts Packmultipleshorttweetstogetherintoasinglebroadcasttweet,space-permitting,sothatit'snotalwaysa1:1correspondencebetweenwordsinthemessagetotweets(notonlyhardertobreak,butalsomoreefficientuseofbandwidth) CreateagraphicaluserinterfaceinSwing,StandardWidgetToolkit,orSeesawasanalternativetothecommandlineinterface UsetheTwitterAPItoposttweetsautomatically,ifanapplicationhasbeendefined,andtherelevantapplicationOAuthsettings(Consumerkey,Consumersecret,etc.)havebeendefinedinconfig.properties About ThisisatextsteganographyapplicationoptimizedforuseonTwitter,writteninClojure. Resources Readme License MITLicense Stars 183 stars Watchers 8 watching Forks 9 forks Releases Noreleasespublished Packages0 Nopackagespublished Languages Clojure 100.0% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?