options.py 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/usr/bin/env python
  2. # -*- coding: iso-8859-15 -*-
  3. """
  4. $Id$
  5. This file is part of the anontwi project, http://anontwi.03c8.net
  6. Copyright (c) 2012/2013/2014/2015 by psy <epsylon@riseup.net>
  7. anontwi is free software; you can redistribute it and/or modify it under
  8. the terms of the GNU General Public License as published by the Free
  9. Software Foundation version 3 of the License.
  10. anontwi is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  13. details.
  14. You should have received a copy of the GNU General Public License along
  15. with anontwi; if not, write to the Free Software Foundation, Inc., 51
  16. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. """
  18. import optparse
  19. class AnonTwiOptions(optparse.OptionParser):
  20. def __init__(self, *args):
  21. optparse.OptionParser.__init__(self,
  22. #description='FIGHT CENSORSHIP!! being more safe on social networking sites...',
  23. prog='anontwi.py',
  24. version='\nAnonTwi -GNU/Social Edition- | 2015\n',
  25. usage= '\n\n +Info: README.\n\n Syntax: ./anontwi [OPTIONS] [--tokens] [--gtk | --irc=] [Controller] [Miscellania] [Encryption]')
  26. #self.add_option("-v", "--verbose", action="store_true", dest="verbose", help="active verbose mode output results")
  27. group4 = optparse.OptionGroup(self, "API")
  28. group4.add_option("--tokens", action="store_true", dest="tokens", help="set your OAuth 'key' and 'secret' tokens (REQUIRED!) ")
  29. self.add_option_group(group4)
  30. group5 = optparse.OptionGroup(self, "Interfaces")
  31. group5.add_option("--gtk", action="store_true", dest="gtk", help="start GTK+ Window Interface (visual mode)")
  32. #group5.add_option("--web", action="store_true", dest="webserver", help="start WeGUI server on: 'http://localhost:8080'")
  33. group5.add_option("--irc", action="store", dest="ircbot", help="start an IRC slave bot, connected to Anontwi: 'anontwibot@irc.freenode.net:6667#anontwi'")
  34. self.add_option_group(group5)
  35. group3 = optparse.OptionGroup(self, "Controller")
  36. group3.add_option("-m", action="store", dest="tweet", help="send Tweet (ex: -m 'text')")
  37. group3.add_option("-r", action="store", dest="retweet", help="reTweet and existing message (ex: -r 'ID')")
  38. group3.add_option("-d", action="store", dest="dm", help="send Direct Message (ex: -m 'text' -d '@user')")
  39. #group3.add_option("-i", action="store", dest="image", help="send an IMAGE, using spoofed headers and fake metadata")
  40. group3.add_option("-f", action="store", dest="friend", help="create friendship with a user (ex: -f '@user')")
  41. group3.add_option("-u", action="store", dest="dfriend", help="destroy friendship with a user (ex: -u '@user')")
  42. group3.add_option("--reply", action="store", dest="reply", help="reply conversation (ex: -m '@user text' --reply 'ID')")
  43. group3.add_option("--fav", action="store", dest="favorite", help="create favorite (ex: --fav 'ID')")
  44. group3.add_option("--unfav", action="store", dest="unfavorite", help="destroy favorite (ex: --unfav 'ID')")
  45. group3.add_option("--block", action="store", dest="block", help="block a user on the network (ex: --block '@user')")
  46. group3.add_option("--unblock", action="store", dest="unblock", help="unblock a user on the network (ex: --unblock '@user')")
  47. group3.add_option("--rm-m", action="store", dest="rmtweet", help="remove Tweet (ex: --rm-m 'ID')")
  48. group3.add_option("--rm-d", action="store", dest="rmdm", help="remove Direct Message (ex: --rm-d 'ID')")
  49. group3.add_option("--suicide", action="store_true", dest="suicide", help="remove Tweets, DMs and try to close account")
  50. #group3.add_option("--mf", action="store", dest="massfriend", help="create massive friendships (ex: --fm 'list.txt')")
  51. #group3.add_option("--md", action="store", dest="massdfriend", help="destroy massive friendships (ex: --fm 'list.txt')")
  52. self.add_option_group(group3)
  53. group1 = optparse.OptionGroup(self, "Miscellania")
  54. group1.add_option("--proxy", action="store", dest="proxy", help="use proxy (tor: --proxy 'http://localhost:8118')")
  55. group1.add_option("--short", action="store", dest="shorturl", help="short an url (ex: --short 'url')")
  56. group1.add_option("--ts", action="store", dest="search", help="search a number of results (ex: --ts '#15m 10')")
  57. group1.add_option("--tu", action="store", dest="timeline", help="show a number of Tweets of a user (ex: --tu '@nick 5')")
  58. group1.add_option("--td", action="store", dest="timelinedm", help="show a number of DMs sent to you (ex: --td '5')")
  59. group1.add_option("--tf", action="store", dest="timelinef", help="show tweets of user's friends (ex: --tf '5')")
  60. group1.add_option("--tt", action="store_true", dest="topics", help="check global Trending Topics (ex: --tt)")
  61. group1.add_option("--me", action="store", dest="mentions", help="returns recent mentions about you (ex: --me '5')")
  62. group1.add_option("--save", action="store", dest="save", help="save tweets starting from the last (max: 3200)")
  63. group1.add_option("--tfav", action="store", dest="showfavs", help="returns favorites (ex: --tfav '@nick 10')")
  64. group1.add_option("--sfav", action="store", dest="savefavs", help="save favorites (ex: --sfav '@nick 10')")
  65. group1.add_option("--waves", action="store_true", dest="wave", help="split long message into waves (ex: -m 'text' --waves)")
  66. group1.add_option("--gps", action="store_true", dest="location", help="send fake geo-places (ex: --gps '(-43.5209),146.6015')")
  67. #group1.add_option("--via", action="store", dest="via", help="suggest 'via' value detailed on website")
  68. group1.add_option("--rgb", action="store_true", dest="rgb", help="use detailed colourful output results")
  69. self.add_option_group(group1)
  70. group2 = optparse.OptionGroup(self, "Encryption")
  71. group2.add_option("--gen", action="store_true", dest="genkey", help="generate PIN key for encrypting/decrypting messages")
  72. group2.add_option("--enc", action="store_true", dest="encaes", help="encrypt message using PIN key")
  73. group2.add_option("--dec", action="store", dest="decaes", help="message or URL to decrypt using PIN key")
  74. group2.add_option("--pin", action="store", dest="key", help="PIN key for encryption/decryption")
  75. self.add_option_group(group2)
  76. def get_options(self, user_args=None):
  77. (options, args) = self.parse_args(user_args)
  78. options.args = args
  79. if (not options.gtk and not options.encaes and not options.ircbot and not options.showfavs and not options.savefavs and not options.favorite and not options.unfavorite and not options.tokens and not options.tweet and not options.dm and not options.search and not options.friend and not options.dfriend and not options.retweet and not options.timelinef and not options.timeline and not options.timelinedm and not options.mentions and not options.genkey and not options.decaes and not options.save and not options.topics and not options.rmtweet and not options.rmdm and not options.suicide and not options.block and not options.unblock and not options.shorturl):
  80. print '='*75
  81. print self.version
  82. print '='*75, "\n"
  83. print " . : . "
  84. print " '. . : . .' "
  85. print " ._ '._.-'''-._.' _. #15M "
  86. print " '-..' '..-' "
  87. print " --._ /.==. .==.\ _.-- #HackSol"
  88. print " ;/_o__\ /_om__\; "
  89. print " -----|` ) ( `|----- #Spanishrevolution"
  90. print " _: \_) (\_/) (_/ ;_ "
  91. print " --' \ '._.=._.' / '-- #Worldrevolution"
  92. print " _.-''. '._.' .''-._ "
  93. print " ' .''-.(_).-''. ' "
  94. print " ' ' : ' '. "
  95. print " ' : ' Share about R/evolution, not about you!"
  96. print " ' "
  97. print '='*75
  98. print "\nFor HELP use -h or --help"
  99. print "---------------\n"
  100. print "GUI Interfaces:"
  101. print " * GTK+ (Graphical): --gtk"
  102. #print " * WebGUI: use --web"
  103. print " * IRC-Bot: --irc='nick@server:port#channel'\n"
  104. print '='*55, "\n"
  105. return False
  106. return options