This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get all the logs | |
tail -f /var/log/nginx/access.log | | |
# Extract IP and Timestamp for example | |
awk '{print $1 " " substr($4, 2, length($4) - 7)}' FPAT='[^ ]*|"[^"]*"|\\[[^]]*\\]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tail -f /var/log/nginx/access.log | \ | |
# parsing every line | |
gawk '{print $1 " " substr($4, 2, length($4) - 8) " " $6 " " $7 " " substr($5, 2, length($5) -2) " " substr($8, 2, length($8)-2) " " $9; system("")}' FPAT='[^ ]*|"[^"]*"|\\[[^]]*\\]' | \ | |
# inserting every new line into sqlite | |
(while read ip timestamp status_code bytes_sent request_method request_url request_protocol referrer user_agent; do sqlite3 -batch /home/logger/logs.db "insert into todo (ip, timestamp, status_code, bytes_sent, request_method, request_url, request_protocol, referrer, user_agent) values (\"$ip\",\"$timestamp\", \"$status_code\", \"$bytes_sent\", \"$request_method\", \"$request_url\", \"$request_protocol\" ,\"$referrer\" , $user_agent);"; done ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim /etc/nginx/nginx.conf: | |
#add: | |
log_format mycombined '$remote_addr - $remote_user [$time_iso8601] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'; | |
access_log /var/log/nginx/access.log mycombined; | |
nginx -s reload |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyautogui | |
import time | |
import random | |
screenWidth, screenHeight = pyautogui.size() | |
currentMouseX, currentMouseY = pyautogui.position() | |
while True: | |
pyautogui.moveTo(random.randint(1, 1000), random.randint(1, 500)) | |
time.sleep(20) |
NewerOlder