Skip to content

Instantly share code, notes, and snippets.

@dvas0004

dvas0004/TwitHide.py

Last active Oct 13, 2016
Embed
What would you like to do?
import twitter
import cPickle as pickle
import shutil
import subprocess, os
stegPasscode = 'helloWorld'
consumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
access_token_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
user = 'davevassallo6'
nothing_new=True
try:
last_id_retrieved = pickle.load(open("/tmp/twitter_steg_id.p", "rb"))
except:
last_id_retrieved = None
api = twitter.Api(consumer_key=consumer_key,
consumer_secret=consumer_secret,
access_token_key=access_token_key,
access_token_secret=access_token_secret)
if last_id_retrieved:
statuses = api.GetUserTimeline(user, since_id=str(last_id_retrieved))
else:
statuses = api.GetUserTimeline(user)
for s in statuses:
try:
if s.id == last_id_retrieved:
continue
else:
last_id_retrieved = s.id
nothing_new=False
dest = open('/tmp/tesSDJD', 'wb')
f = twitter.twitter_utils.parse_media_file(s.media[0].media_url)[0]
shutil.copyfileobj(f, dest)
dest.close()
result = subprocess.check_output(
["steghide", "extract", "-f", "-sf", "ret.jpg", "-p", stegPasscode, "-xf", "/dev/stdout"])
print "Got some commands: {}".format(result)
except:
continue
try:
pickle.dump(last_id_retrieved, open("/tmp/twitter_steg_id.p", "wb"))
os.remove('/tmp/tesSDJD')
print 'Done'
except:
if nothing_new:
print "Nothing New"
else:
print "Done without saving state or cleanup"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.