LPedia:BWABOM

From LPedia
Jump to navigation Jump to search
#!/usr/bin/python

#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#
#                                 #
# Bulk-Wiki-Attacker-Block-O-Mat  #
#                                 #
#          version 0.1            #
#                                 #
#    Developed for LPedia.org     #
#    by James Gholston, 2007      #
#                                 #
#         Public Domain           #
#                                 #
#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#%#

# torque       -- how much to squeeze (rule of thumb: 
#                 single attack is 3 years, multiple per name is 5 --
#                 this helps to identify attack severity when looking at
#                 the logfile)
# roster       -- list of offending accounts entered
# reason       -- hardwired as "SPAM"
# blockheads   -- holding list while assembling roster
# whack_a_pest -- iteration through roster
# venue        -- location of output html file with links
# implement    -- output html
# range        -- is the output successfully saved to the firing range?
# gallery      -- file object

reason="SPAM"

# Select duration in days (1096, 1827, et c.)
torque = raw_input("Block block of bulk blockheads for this many days:")

# Get the list of bulk usernames to block
roster = []
blockheads = "1"

print "Paste and/or type in list of destructive accounts; press return more than once if necessary."
# if line != "" keep going
while(blockheads):
          blockheads = raw_input(">>>>")
          if(blockheads): roster += [blockheads]

# Output html page with list of links to open to block them

implement = "<HTML><HEAD><TITLE>Bulk-Wiki-Attacker-Block-O-Mat shooting gallery</TITLE></HEAD><BODY>\n"

for whack_a_pest in roster:
    implement += "<A href=\"http://www.lpedia.org/index.php?title=Special:Blockip&wpBlockAddress=" + whack_a_pest + "&wpBlockExpiry=" + torque + "%20days&wpBlockReason=" + reason + "\">Open in new tab to ban " + whack_a_pest + " for " + torque + " days</A><BR/>\n" 

implement += "</BODY></HTML>\n"

# print implement

# save file to disk (or possibly disc, although *I* can't save 
# a file directly to disc right now)

# commented out fault tolerance code not tested yet

range = 0

print "save html file as (path and filename) -- .html extension suggested"
while not range:
      venue = raw_input("file and path to save:")
      #try:
      gallery=open(venue, "w")
      gallery.write(implement)
      gallery.close()
      range=1
      #except:
      #if gallery: gallery.close()
      #print "Something went wrong.  Let's try that again."

# Enjoy!

print
print "Open "+venue+" in your preferred tab-capable web browser and have a blast!"