Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hmm

Pages: [1] 2
1
Operating System / Re: Linux beginner question
« on: September 09, 2012, 08:42:23 pm »
I may take a crack at LFS, i'll do more research, it seems like a lovely project, and provided I partition my hard drive correctly I shouldnt have any issues correct? I only ask because uni is about to start up and i will surely need my computer functioning.

2
Operating System / Re: Linux beginner question
« on: September 09, 2012, 08:01:37 pm »
My qualms with Debian would be that it wouldn't force me to learn anything. Thats what happened with mint, I got by really easy and didn't learn anything, so I never used it. I think that having almost total control would force me to figure out exactly how all my shit works. I do not know if Debian offers this to the same degree. Does it?

3
Operating System / Linux beginner question
« on: September 09, 2012, 10:27:39 am »
I'm rather new to linux, but I used Mint 12 for about a week and found it rather dull and unnecessary. I think linux has a lot to offer, but Mint never really forced me to learn anything. I feel (I could be wrong) that using something like Arch or Gentoo would provide me with much more knowledge. My questions are as follows: 1. Would I be bitting off too much by choosing one of these? and 2. Would I actually learn a lot? Thanks.

4
Projects and Discussion / Re: Forum Spammer.
« on: September 06, 2012, 10:24:00 am »
So i'm a bit confused about how to use a socket. I got how to make one/send data and all that, but how can I execute commands, such as send_keys in selenium? Could it be my lack of web programming knowledge thats inhibiting me? Any help would be greatly appreciated. Note: I think I might try and switch my project into C as well, but I can probably rework a python snippet too. Thanks.



Below are updated versions of my project (note to those who run this forum: If this is not appropriate to do, feel free to remove and shoot me a PM with some guidelines, but I thought a little on-going project updates would be nice). This has also turned into more of a twitter spammer, but, alas, I feel the principles could still be applicable. Also, I would like help on my question above as it would give my project MUCH MUCH more heft.


So, first and acct. creator:
Code: (python) [Select]
from urllib import urlopen
import re
import string
import random
import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
lnum=['0', '1', '2', '3','4', '5', '6', '7', '8', '9']
llet=['a','b','c','d', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p','q','r','s','t','u','v','w', 'x', 'y' 'z']
names=[]
pw= ##pick a password you want to use.
for n in range(0,XXXXXX):  ##pick how many accounts you want to create at in one ... spawn???
    a=random.choice(llet)
    b=random.choice(llet)
    c=random.choice(lnum)
    d=random.choice(lnum)
    e=random.choice(lnum)
    f=random.choice(llet)
    g=random.choice(lnum)
    h=random.choice(llet)
    i=random.choice(llet)
    j=random.choice(llet)
    user = a+b+c+d+e+f+g+h+i+j+'@XXXX.com'
 ##generates random username with  a low probability of being allready taken, also pick whatever mail service you want to hose it on.
    names.append(user)
    print user
    browser= webdriver.Firefox()
    browser.get('http://www.twitter.com')
    elem = browser.find_element_by_name("user[name]")
    elem.send_keys(a+b)
    elem = browser.find_element_by_name("user[email]")
    elem.send_keys(user)
    elem= browser.find_element_by_name("user[user_password]")
    elem.send_keys(pw)
    browser.find_element_by_css_selector(".btn.signup-btn").click()
    time.sleep(2)
    browser.find_element_by_name("user[remember_me_on_signup]").click()
    browser.find_element_by_css_selector(".submit.button.promotional").click()
##the above will launch X firefox window, and, sadly, you have to manually enter the captchas
f=open('tusers.txt', 'a')
for item in names:
    f.write(item + '\n')


##finally writes them to a file for late use



Next is the actual spammer, you need to have a .txt file created with your possible tweets.

Code: (python) [Select]
from urllib import urlopen
import re
import string
import random
import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from multiprocessing import Process, Array, Pool


users1=[]
amazon=[]
fly=[]
desc=[]
users2=[]
slogan=['WTF', 'THIS!', 'OMG', 'HAHA', 'YES', 'ITS MY BDAY', 'DRUNKK']
pw=XXXXX ##your password for the acts.
##below is the username file, followed by however many .txt files you need to make it work, i'm using three for my current project.
f = open('tusers.txt', 'r')
for line in f:
    back = line.find('\n')
    line = line[:back]
    users1.append(line)
f.close()
f = open('alinks.txt', 'r')
for item in f:
    if item !='\n':
        amazon.append(item)
f.close()
f = open('flylinks.txt', 'r')
for item in f:
    if item !='\n':
        fly.append(item)
f.close()
f = open('descs.txt', 'r')
for item in f:
    if item !='\n':
        desc.append(item)
##checks xpath is vis.
def check_xpath(xpath,browser):
    try:
        browser.find_element_by_xpath(xpath)
    except NoSuchElementException:
        return False
    return True
def twitter(user):
    browser = webdriver.Firefox()
    browser.get('http://www.twitter.com')
    elem = browser.find_element_by_css_selector(".text-input.email-input")
    elem.send_keys(str(user))
    elem= browser.find_element_by_css_selector(".text-input.flex-table-input")
    elem.send_keys(str(pw))
    browser.find_element_by_css_selector(".submit.btn.primary-btn.flex-table-btn.js-submit").click()
    print user + ' LOGGED IN'
    time.sleep(2)
##below checks suspension
    if check_xpath(".//*[@id='account-suspended']/span[1]", browser) == True:
        print user + ' ' + 'SUSPENDED'
        browser.close()
##if not suspended, find a hashtag, which will be tweeted
    else:
        p1=".//*[@id='page-node-home'][1][5][2]/ul/li["
        p2=str(random.choice(range(2,6)))
        p3="]/a"
        path = p1+p2+p3
        print 'path found'
        if check_xpath(path, browser) == False:
            browser.close()
            return
        elem = browser.find_element_by_xpath(path)
        hashtag=elem.text
## If hashtag non-ascii it will not be used.
        for char in hashtag:
            if ord(char)>128:
                hashtag=''
        while(True):
            try:
                elem = browser.find_element_by_class_name("twitter-anywhere-tweet-box-editor")
                elem.click()
##below tweets hashtag + random crap, use what you will.
                elem.send_keys(str(hashtag) +' ' + random.choice(slogan)+ ' ' + random.choice(fly))
                break
            except NoSuchElementException:
                time.sleep(.1)
        browser.find_element_by_css_selector(".tweet-button.btn.primary-btn").click()
##below searches twitter RSS for a target user you want to reply to.
        term = whatever the fuck you want.
        st = term
        webpage = urlopen('http://search.twitter.com/search.rss?q=' + st).read()
        front = webpage.find('<author>')
        back = webpage.find('@',front)
        person=webpage[front+8:back]
##throws out bad searches
        if 'ersion' in person:
            twit=' '
        else:
            twit = '@'+person
            if len(twit) > 100:
                twit = ''
        elem = browser.find_element_by_class_name("twitter-anywhere-tweet-box-editor")
##below checks shiz in text file, and cuts tweet, feel free to make the cut whereever you need.
        detwee = desc[q][:87].decode('utf-8')
        detwee = detwee.encode('utf-8')
##checks ascii, I could clean this whole section up.
        for char in detwee:
            if ord(char)>128:
                detwee = 'WHOOPS'
##tweets you whiz
        elem.send_keys(str(twit) +' ' + detwee+ ' ' + fly[q])
        browser.find_element_by_css_selector(".tweet-button.btn.primary-btn").click()
        browser.close()


##does it for all accounts in tusers, and keeps on a doin.
counter = 0
while(True):
    for item in users1:
        twitter(item)
        counter +=1
        print 'SENT TWEETS: ', counter
   
Still tweaking stuff, and there is some dumb shit I should clean up. My major problem is lack of threading or multi-processing as it will not work with selenium, so I'd like to recode it using C sockets (if possible) for multiprocessing/threading reasons. Also my C is really rusty, so it'd be nice practice. Also I cut out a large section which involved targeting my @ reply shit which I rather liked, but none of you all would probably want to see.


STAFF EDIT
Twice in the same thread. No double posting, you know how to use the edit button, be sure to use it next time instead of double posting

5
Projects and Discussion / Re: Forum Spammer.
« on: August 30, 2012, 06:35:17 am »
I take it by your comments I should read some serious literature on sockets?

6
Scripting Languages / Re: [py] script f'ing up?
« on: August 29, 2012, 05:56:25 am »
I shall try this in a few days, however, my kind had to do with my computer falling asleep? Very strange. Multi-processing/threading still do not work, though I'll try playing around with them a little more post debugger.

7
Projects and Discussion / Re: C or Python?
« on: August 28, 2012, 11:05:20 pm »
Also if you google Harvard CS50, they have video lectures on it.

8
Scripting Languages / Re: [py] script f'ing up?
« on: August 26, 2012, 12:06:04 pm »
No output, thats really the dig. On any of my issues. They simply don't produce. Note:if you test it I still have to mess with preciously sent tweets, but I should be able to handle that, and it won't effect the above problems.

9
Scripting Languages / [py] script f'ing up?
« on: August 25, 2012, 09:43:17 pm »
So this is part of my forum spamming project, so I didn't know if I should post here or there, but it's ultimately  a python question. My script kind of gets snagged randomly, i.e, i'll test for all accts. and its fine-n-dandy, and when it comes time to run it all together it makes it through like 3 and then gets f'd. I'd also like to multi-proccess/multi-thread this, so I can have multiple accts going at one, but even when trying to thread, it halts after the login step, and I cant even get multi-processing to work. I tried to just run the python example script(see there website) and got no values printed out.
Code: (python) [Select]

from urllib import urlopen
import re
import string
from twitter import *
import random
import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import threading


usr=[]##list of usernames
pw = ##a password
tweets=[]


f = open('ap.txt', 'r')
for line in f:
    line = line.decode('utf-8')
    if len(line)>120:
        front= len(line)-120
        line = line[front:]
    tweets.append(line)
while(True):
    for item in usr:
        browser = webdriver.Firefox()
        browser.get("http://www.twitter.com/")
        elem = browser.find_element_by_css_selector(".text-input.email-input")
        elem.send_keys(item)
        elem = browser.find_element_by_css_selector(".text-input.flex-table-input")
        elem.send_keys(pw)
        browser.find_element_by_css_selector(".submit.btn.primary-btn.flex-table-btn.js-submit").click()
        time.sleep(2)
##the below only works on one thread, when I attempt to thread.
        for i in range(0,15):
            temp=[]
            t = random.choice(tweets)
            if t in temp:
                while(t in temp):
                    t = random.choice(tweets)
            temp.append(t)
            t = 'F'
            while(t == 'F'):
                try:
                    browser.find_element_by_class_name("twitter-anywhere-tweet-box-editor").send_keys(t)
                    t = 'T'
                except:
                    time.sleep(.1)
            t='F'
            time.sleep(2)
            while(t=='F'):
                try:
                    browser.find_element_by_css_selector(".tweet-button.btn.primary-btn").click()
                    t = 'T'
                except:
                    time.sleep(.1)


            time.sleep(15)


        browser.find_element_by_xpath(".//*[@id='page-node-home'][1][5][2]/ul/li[2]/a").click()
        browser.find_element_by_class_name("toggle-item-2 ").click()


        time.sleep(2)
##below is where my random snag is happening. I believe.
        peeps = browser.find_elements_by_css_selector(".account-group.js-account-group.js-action-profile.js-user-profile-link")
        for i in range(0,10):
            peeps[i].click()
            while(True):
                try:
                    browser.find_element_by_css_selector(".js-action-follow.follow-text.action-text").click()
                    break
                except:
                    time.sleep(.1)
            browser.find_element_by_class_name("twttr-dialog-close").click()
            time.sleep(1)


        browser.close()
        time.sleep(100)

11
Projects and Discussion / Re: Forum Spammer.
« on: August 17, 2012, 07:56:28 pm »
This will auto post random lines from a file to however many blogspot blogs you have, but youll get fucked by the captcha.


Code: (python) [Select]
import random
import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
## open text file from which to get lines from

f = open('XXXXX.txt', 'r')
post_list=[]
for line in f:
        post_list.append(line)
## Below goes to blogger
b = webdriver.Firefox()
b.get('http://www.blogger.com')
email = b.find_element_by_id('Email')
email.send_keys('XXXXXX')
password = b.find_element_by_id('Passwd')
password.send_keys('XXXXX')
b.find_element_by_id('signIn').click()
##posting: For the first range specify how many blogs you have lower bound is always one upper bound is # of blogs - 1 (I tested on 5). The second for is how many posts you want to make on one of your blogs, I again was testing five.
while(True):
    for i in range(1,6):
        p1 = ".//*[@id='XXXX'][3][2][2][2][3][2]["
        p2 = str(i)
        p3 = "][4]/a[1]"
        path = p1 + p2 + p3
        b.find_element_by_xpath(path).click()
        for n in range(0,5):
            time.sleep(3)
            b.find_element_by_xpath(".//*[@id='XXXX'][3][3]/form[1][2]/span[1]/span/button[2]").click()
            b.find_element_by_id('XXXX').send_keys(random.choice(post_list))
            b.find_element_by_xpath(".//*[@id='XXX'][3][3]/form[1][1]/span/button[1]").click()
            time.sleep(5)
            if n == 4:
                b.find_element_by_css_selector("XXXXX").click()
                time.sleep(5)
            else:
                b.find_element_by_xpath(".//*[@id='XXXXX'][3][2][1]/a[2]").click()
Note: the sleeps are to wait for load times, although I have been considering using seleniums wait for load time john



The below is a twitter bot which will again tweet randomly from a TXT file. I'm trying currently to support multiple threads, but selenium is being a fuck for that. If anyone has any idea how to do this, PLEASE PLEASE PLEASEEEEE hook it up.
Code: (python) [Select]


from urllib import urlopen
import re
import string
from twitter import *
import random
import time
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
import threading






tweets=[]


f = open('ap.txt', 'r')
for line in f:
    if len(line)>120:
        line = line[:120]
    line = line.decode('utf-8')
    tweets.append(line)
def wait_for_element(e, browser):
    if browser.is_element_present(e):
        return e
    else:
        time.sleep(.1)


class twit(threading.Thread):
    def __init__(self, usr, pw):
        threading.Thread.__init__(self)
        self.usr = usr
        self.pw = pw
        self.browser = webdriver.Firefox()
    def run(self):
        self.browser.get("http://www.twitter.com/")
        elem = self.browser.find_element_by_css_selector(".text-input.email-input")
        elem.send_keys(self.usr)
        elem = self.browser.find_element_by_css_selector(".text-input.flex-table-input")
        elem.send_keys(self.pw)
        self.browser.find_element_by_css_selector(".submit.btn.primary-btn.flex-table-btn.js-submit").click()
        time.sleep(2)
        i=0
        while(True):
            while(True):
                try:
                    self.browser.find_element_by_class_name("twitter-anywhere-tweet-box-editor").send_keys(random.choice(tweets))
                    break
                except:
                    time.sleep(.1)
            while(True):
                try:
                    self.browser.find_element_by_css_selector(".tweet-button.btn.primary-btn").click()
                    break
                except:
                    time.sleep(.1)
            time.sleep(3)

username = raw_input('Enter your usename: ')
password = raw_input('Enter your password: ')
t1 = twit(username, password)


t1.start()


Staff Edit
Please use the edit button, do NOT double post

12
Scripting Languages / Re: Relatively crummy scraper.
« on: August 01, 2012, 03:29:38 am »
Pretty sure its 2.7, and classes probably would have been a cleaner way to go. thanks for the heads up.

13
Projects and Discussion / Re: Forum Spammer.
« on: August 01, 2012, 03:26:16 am »
Got that jazz down. Currently looking for a way to get around captcha, if anyone has any info(looking into OCRs already). Also just a general question, am I not supposed to ask questions on here or something?

14
Scripting Languages / Re: Relatively crummy scraper.
« on: July 31, 2012, 10:23:05 am »
Whoops. Thanks for the heads up. It's all there now.

15
Projects and Discussion / Re: Forum Spammer.
« on: July 31, 2012, 10:08:28 am »
I think it would be a nice learning experience. Thanks. If anyone has any links feel free to toss them over.

Pages: [1] 2