Spam message w/ Line Unofficial API

最近幫一個公司進行 LINE 行銷,

所以寫了一個草版 Python 可以進行第一步的 Spam,

來給對方公司展示用的。

此腳本會讀取同目錄的 post.txt 第一行來進行傳送訊息,

每一則訊息會延遲 0.5 秒因為 LINE 發現可疑操作會 BAN IP 24 小時。

不過要是不要命的傳送法 大約一秒 20 則 直接把 sleep 去掉即可。

優化的方法大概就是加上 Multi Threading 來進行同步發送。

# -*- coding: utf-8 -*-
import line  
import time

def main():

    try:
        client = line.LineClient("account", "password", com_name='Spamming System Loaded.')
        #client = LineClient(authToken="AUTHTOKEN")
    except:
        print "Login Failed"

    print "Logged in."
    profile = client.profile
    print "Currently Profile Name Is %s" % profile

    contact_list = []
    contact_list = client.contacts
    print "Numbers of Friends : %s" % len(contact_list)
    group_list = []
    group_list = client.groups
    print "Numbers of Groups : %s" % len(group_list)


    ## Start mashing the message.
    pend = 0
    file = open('post.txt', 'r')
    txt = file.readline():

    for x in contact_list:
        pending = client.contacts[pend]
        pending.sendMessage('%s' % txt)
        print "%s to %s : %s" % profile, pending, txt
        x = x + 1
        #Prevent BAN IP
        time.sleep(0.5)

    pend_g = 0    
    for y in group_list:
        pending_g = client.groups[pend_g]
        pending_g.sendMessage('%s' % txt)
        print "%s to %s : %s" % profile, pending_g, txt
        y = y + 1
        #Prevent LINE BAN IP
        time.sleep(0.5)

    file.close()
    print "done."


if __name__ == '__main__':  
    main()

Ghost Writer

There is nothing here.

Kaohsiung https://th3nd.com

Subscribe to In Th3nd

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!