Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cybertron
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
cybertron
Commits
c1ef7414
Commit
c1ef7414
authored
Apr 25, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
9615b761
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
150 additions
and
37 deletions
+150
-37
workspace.xml
.idea/workspace.xml
+0
-0
auto_click1.py
auto_click1.py
+48
-37
auto_click2.py
auto_click2.py
+52
-0
auto_click3.py
auto_click3.py
+50
-0
No files found.
.idea/workspace.xml
View file @
c1ef7414
This diff is collapsed.
Click to expand it.
auto_click.py
→
auto_click
1
.py
View file @
c1ef7414
...
...
@@ -4,29 +4,33 @@ import random
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
login
,
click
,
time_conv
s
from
auto_request
import
login
,
click
,
time_conv
from
auto_request
import
host
,
user
,
db
,
passwd
def
get_data
(
numtime
,
numtime2
):
def
get_data
(
numtime
):
try
:
pc
=
pymysql
.
connect
(
host
=
host
,
user
=
user
,
passwd
=
passwd
,
db
=
db
,
port
=
3306
)
cursor
=
pc
.
cursor
()
cursor
.
execute
(
"SELECT user_id,id FROM topic WHERE is_online=1 and create_time > '
%
s' and create_time <= '
%
s'"
%
(
numtime
,
numtime2
))
"SELECT user_id,id FROM topic WHERE is_online=1 and create_time > '
%
s'"
%
numtime
)
data
=
cursor
.
fetchall
()
topic_id
=
list
(
data
)
topic_id_list
=
[]
for
i
in
topic_id
and
topic_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0"
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
if
user_id
:
topic_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
try
:
for
i
in
topic_id
and
topic_id
:
cursor
.
execute
(
"select user_id from user_extra where user_id ="
+
str
(
i
[
0
])
+
" and is_shadow =0"
)
data
=
cursor
.
fetchall
()
user_id
=
list
(
data
)
if
user_id
:
topic_id_list
.
append
(
i
)
logging
.
info
(
"Database version :
%
s "
%
topic_id_list
)
pc
.
close
()
except
:
pass
return
topic_id_list
except
:
...
...
@@ -34,46 +38,53 @@ def get_data(numtime, numtime2):
return
[]
def
write_id_file
(
id
):
try
:
data
=
open
(
"save_topic_id.txt"
,
"a"
)
data
.
write
(
id
)
data
.
write
(
"/n"
)
except
:
pass
if
__name__
==
"__main__"
:
try
:
time_list
=
[
3
,
4
,
5
,
6
,
7
]
for
i
in
time_list
:
numtime
,
numtime2
=
time_convs
(
i
+
1
,
i
-
1
)
user_id
=
get_data
(
numtime
,
numtime2
)
dicts
=
{}
numtime
=
time_conv
(
10
)
user_id
=
get_data
(
numtime
)
dicts
=
{}
if
user_id
:
if
user_id
:
for
i
in
user_id
:
for
i
in
user_id
:
if
i
[
0
]
not
in
dicts
.
keys
():
dicts
.
setdefault
(
i
[
0
],
[])
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
else
:
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
if
i
[
0
]
not
in
dicts
.
keys
():
dicts
.
setdefault
(
i
[
0
],
[])
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
for
key
,
value
in
dicts
.
items
():
else
:
dicts
[
i
[
0
]]
.
append
(
i
[
1
])
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
for
key
,
value
in
dicts
.
items
():
rand_id
=
value
[
rand_num
]
rand_num
=
random
.
randint
(
0
,
len
(
value
)
-
1
)
time
.
sleep
(
random
.
randint
(
1
,
10
)
)
rand_id
=
value
[
rand_num
]
cook
=
login
()
urge_num
=
random
.
randint
(
0
,
1
)
if
cook
is
not
None
:
for
i
in
range
(
urge_num
):
click
(
cook
,
rand_id
)
time
.
sleep
(
random
.
randint
(
1
,
10
)
)
write_id_file
(
rand_id
)
cook
=
login
()
if
cook
is
not
None
:
click
(
cook
,
rand_id
)
else
:
pass
else
:
pass
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
auto_click2.py
0 → 100644
View file @
c1ef7414
import
time
import
pymysql
import
random
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
login
,
click
,
time_conv
def
write_id_file
():
try
:
user_ids
=
[]
data
=
open
(
"save_topic_id.txt"
,
"r"
)
data2
=
open
(
"save_topic_id_three.txt"
,
"w"
)
for
i
in
data
.
readlines
():
data2
.
write
(
i
)
data2
.
write
(
"
\n
"
)
user_ids
.
append
(
i
)
data
.
truncate
()
return
user_ids
except
:
return
[]
if
__name__
==
"__main__"
:
try
:
user_ids
=
write_id_file
()
lenn
=
len
(
user_ids
)
random
=
[]
for
i
in
range
(
lenn
/
2
):
rand_num
=
random
.
randint
(
0
,
lenn
)
random
.
append
(
lenn
[
rand_num
])
for
i
in
random
:
time
.
sleep
(
random
.
randint
(
10
,
50
))
cook
=
login
()
if
cook
is
not
None
:
click
(
cook
,
i
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
auto_click3.py
0 → 100644
View file @
c1ef7414
import
time
import
pymysql
import
random
import
traceback
from
log_settings
import
*
import
logging
from
auto_request
import
login
,
click
,
time_conv
def
write_id_file
():
try
:
user_ids
=
[]
data
=
open
(
"save_topic_id_three.txt"
,
"r"
)
for
i
in
data
.
readlines
():
user_ids
.
append
(
i
)
data
.
truncate
()
return
user_ids
except
:
return
[]
if
__name__
==
"__main__"
:
try
:
user_ids
=
write_id_file
()
lenn
=
len
(
user_ids
)
random
=
[]
for
i
in
range
(
lenn
/
2
):
rand_num
=
random
.
randint
(
0
,
lenn
)
random
.
append
(
lenn
[
rand_num
])
for
i
in
random
:
time
.
sleep
(
random
.
randint
(
10
,
30
))
cook
=
login
()
if
cook
is
not
None
:
click
(
cook
,
i
)
except
:
logging
.
error
(
"catch exception,main:
%
s"
%
traceback
.
format_exc
())
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment