commit
3fe7e38088
17 changed files with 370 additions and 0 deletions
@ -0,0 +1,70 @@ |
|||||||
|
#!/usr/bin/env python3 |
||||||
|
import subprocess |
||||||
|
import datetime |
||||||
|
import json |
||||||
|
import sys |
||||||
|
|
||||||
|
now = datetime.datetime.now() |
||||||
|
date = now.strftime('%Y%m%d') |
||||||
|
|
||||||
|
server_name = 'hyein.cayangqu.com' |
||||||
|
|
||||||
|
try: |
||||||
|
nama_log = f"auto_replytoaccNretweet.log.{sys.argv[2]}" |
||||||
|
except: |
||||||
|
nama_log = "auto_replytoaccNretweet.log" |
||||||
|
|
||||||
|
def twit_sent(): |
||||||
|
ls_process = subprocess.Popen(["cat",f"/home/telakses/buzz/{sys.argv[1]}/log/{nama_log}"], stdout=subprocess.PIPE, text=True) |
||||||
|
grep_process = subprocess.Popen(["grep", "twit sent with text"], stdin=ls_process.stdout, stdout=subprocess.PIPE, text=True) |
||||||
|
wc_process = subprocess.Popen(["wc", "-l"], stdin=grep_process.stdout, stdout=subprocess.PIPE, text=True) |
||||||
|
output, error = wc_process.communicate() |
||||||
|
return f"Twit sent: {output}" |
||||||
|
|
||||||
|
def twit_failed(): |
||||||
|
ls_process = subprocess.Popen(["cat",f"/home/telakses/buzz/{sys.argv[1]}/log/{nama_log}"], stdout=subprocess.PIPE, text=True) |
||||||
|
grep_process = subprocess.Popen(["grep", "twit failed"], stdin=ls_process.stdout, stdout=subprocess.PIPE, text=True) |
||||||
|
wc_process = subprocess.Popen(["wc", "-l"], stdin=grep_process.stdout, stdout=subprocess.PIPE, text=True) |
||||||
|
output, error = wc_process.communicate() |
||||||
|
return f"Twit failed: {output}" |
||||||
|
|
||||||
|
def twit_failed2(): |
||||||
|
with open(f"/home/telakses/twitmonitor/twit_failed.txt", 'w') as f: |
||||||
|
ls_process = subprocess.Popen(["cat",f"/home/telakses/buzz/{sys.argv[1]}/log/{nama_log}"], stdout=subprocess.PIPE, text=True) |
||||||
|
grep_process = subprocess.Popen(["grep", "twit failed"], stdin=ls_process.stdout, stdout=subprocess.PIPE, text=True) |
||||||
|
output, error = grep_process.communicate() |
||||||
|
#print(output) |
||||||
|
f.write(output) |
||||||
|
f = open("/home/telakses/twitmonitor/twit_failed.txt", "r") |
||||||
|
result = { |
||||||
|
"error_401":0, |
||||||
|
"error_403":0, |
||||||
|
"error_400":0, |
||||||
|
"error_429":0, |
||||||
|
"error_503":0, |
||||||
|
} |
||||||
|
for x in f: |
||||||
|
error=x.split() |
||||||
|
raw_error=error[14] |
||||||
|
clean_error = raw_error[1:4] |
||||||
|
if(int(clean_error) == 401): |
||||||
|
result["error_401"]+=1 |
||||||
|
elif(int(clean_error) == 403): |
||||||
|
result["error_403"]+=1 |
||||||
|
elif(int(clean_error) == 400): |
||||||
|
result["error_400"]+=1 |
||||||
|
elif(int(clean_error) == 429): |
||||||
|
result["error_429"]+=1 |
||||||
|
else: |
||||||
|
result["error_503"]+=1 |
||||||
|
return result |
||||||
|
|
||||||
|
with open(f"/home/telakses/twitmonitor/twit_monitor.txt", 'w') as f: |
||||||
|
f.write(twit_sent()) |
||||||
|
f.write(twit_failed()) |
||||||
|
error = twit_failed2() |
||||||
|
f.write(f"Error 401: {error['error_401']}\n") |
||||||
|
f.write(f"Error 403: {error['error_403']}\n") |
||||||
|
f.write(f"Error 400: {error['error_400']}\n") |
||||||
|
f.write(f"Error 429: {error['error_429']}\n") |
||||||
|
f.write(f"Error 503: {error['error_503']}\n") |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 195 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 195 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 193 |
||||||
|
Twit failed: 2 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 2 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 185 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 195 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 195 |
||||||
|
Twit failed: 2 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 2 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 195 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 192 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 193 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 182 |
||||||
|
Twit failed: 2 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 2 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 185 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,60 @@ |
|||||||
|
#!/usr/bin/env python3 |
||||||
|
import datetime |
||||||
|
import os |
||||||
|
|
||||||
|
now = datetime.datetime.now() |
||||||
|
date = now.strftime('%Y%m%d') |
||||||
|
|
||||||
|
cwd = os.getcwd() |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/haerin.txt") as f: |
||||||
|
print("Haerin") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/hyein.txt") as f: |
||||||
|
print("Hyein") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/hanni.txt") as f: |
||||||
|
print("Hanni") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/noella.txt") as f: |
||||||
|
print("Noella") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/lina.txt") as f: |
||||||
|
print("Lina") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/collection.txt") as f: |
||||||
|
print("Collection") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/wista.txt") as f: |
||||||
|
print("Wista") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/devi.txt") as f: |
||||||
|
print("Devi") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/freya.txt") as f: |
||||||
|
print("Freya") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/calysta.txt") as f: |
||||||
|
print("Calysta") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/eve.txt") as f: |
||||||
|
print("Eve") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/ashel.txt") as f: |
||||||
|
print("Ashel") |
||||||
|
print(f.read()) |
||||||
|
|
||||||
|
with open(f"{cwd}/monitoring/yuvia.txt") as f: |
||||||
|
print("Yuvia") |
||||||
|
print(f.read()) |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 196 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,7 @@ |
|||||||
|
Twit sent: 196 |
||||||
|
Twit failed: 0 |
||||||
|
Error 401: 0 |
||||||
|
Error 403: 0 |
||||||
|
Error 400: 0 |
||||||
|
Error 429: 0 |
||||||
|
Error 503: 0 |
@ -0,0 +1,149 @@ |
|||||||
|
#!/usr/bin/expect -f |
||||||
|
set path [lindex $argv 0] |
||||||
|
set date [lindex $argv 1] |
||||||
|
|
||||||
|
#Haerin |
||||||
|
spawn ssh -p4848 telakses@haerin.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@haerin.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/haerin.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Hyein |
||||||
|
spawn ssh -p4848 telakses@hyein.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@hyein.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/hyein.txt |
||||||
|
expect "password:" |
||||||
|
send "rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Hanni |
||||||
|
spawn ssh -p4848 telakses@hanni.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@hanni.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/hanni.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Noella |
||||||
|
spawn ssh -p4848 telakses@noella.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@noella.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/noella.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Lina |
||||||
|
spawn ssh -p4848 telakses@lina.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@lina.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/lina.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Collection bot |
||||||
|
spawn ssh -p4848 telakses@collection-bot.tel-access.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@collection-bot.tel-access.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/collection.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Wista |
||||||
|
spawn ssh -p4848 hilang@wista.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "2020 ga tau kemana\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 hilang@wista.cayangqu.com:/home/hilang/twitmonitor/twit_monitor.txt ./monitoring/wista.txt |
||||||
|
expect "password:" |
||||||
|
send "2020 ga tau kemana\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Devi |
||||||
|
spawn ssh -p4848 bsmqris@devi.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "2020 kena pa lo\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 bsmqris@devi.cayangqu.com:/home/bsmqris/twitmonitor/twit_monitor.txt ./monitoring/devi.txt |
||||||
|
expect "password:" |
||||||
|
send "2020 kena pa lo\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Freya |
||||||
|
spawn ssh -p4848 telakses@freya.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "2020 Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@freya.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/freya.txt |
||||||
|
expect "password:" |
||||||
|
send "2020 Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Calysta |
||||||
|
spawn ssh -p4848 telakses@calysta.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@calysta.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/calysta.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Eve |
||||||
|
spawn ssh -p4848 telakses@eve.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@eve.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/eve.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Ashel |
||||||
|
spawn ssh -p4848 telakses@ashel.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 telakses@ashel.cayangqu.com:/home/telakses/twitmonitor/twit_monitor.txt ./monitoring/ashel.txt |
||||||
|
expect "password:" |
||||||
|
send "Rahasia123!\r" |
||||||
|
interact |
||||||
|
|
||||||
|
#Yuvia |
||||||
|
spawn ssh -p4848 vconf@yuvia.cayangqu.com './twitmonitor/monitor.py' $path $date |
||||||
|
expect "password:" |
||||||
|
send "2020 salah lagi\r" |
||||||
|
interact |
||||||
|
sleep 1 |
||||||
|
spawn scp -P4848 vconf@yuvia.cayangqu.com:/home/vconf/twitmonitor/twit_monitor.txt ./monitoring/yuvia.txt |
||||||
|
expect "password:" |
||||||
|
send "2020 salah lagi\r" |
||||||
|
interact |
||||||
|
|
||||||
|
spawn ./monitoring/util.py |
||||||
|
interact |
Loading…
Reference in new issue