Finally, after 20 years, my old idea of "assign and return the old value" has been implemented in C++14 in the exchange function incarnation!
Nice!
Nice!
My own thoughts on various things. I may be totally wrong, feel free to discuss.
lsblk /dev/sdX # see what's there swapon -s | grep sdX # check for active swap swapoff /dev/sdXN # deactivate swap if found mount | grep sdX # check for mounted FS umount /dev/sdXN # umount them if found pvs | grep sdX # check for PVs pvdisplay -m /dev/sdXN # find LVs if a PV found umount /dev/mapper/VG-LV # umount LVs if found lvchange -an /dev/mapper/VG-LV # deactivate LVs if any
vgchange -an VG
echo 1 > /sys/block/sdX/device/delete
echo - - - > /sys/class/scsi_host/hostX/scan
lvconvert --repair /dev/mapper/VG-LVraid1 lvremove /dev/mapper/VG-LVpartial vgreduce --removemissing VG
a_conf=/etc/squid/squid.confThen redirect new connections to the new port (i.e. 13128 by default) using iptables NAT.
b_conf=/etc/squid/squid-b.conf
b_pid=/var/run/squid-b.pid
sed -e 's/^http_port \([0-9]\+\)/http_port 1\1/' \
-e '/^cache_dir/d' < $a_conf > $b_conf
echo "pid_filename $b_pid" >> $b_conf
squid -f $b_conf
| Port | Service | Percent | Purpose |
|---|---|---|---|
| 22 | ssh | 12.6877 | Shell access |
| 23 | telnet | 9.4989 | Shell access |
| 1433 | SQL server | 7.13683 | Data compromise, exploits |
| 21320 | SpyBot proxy | 5.80395 | Spam |
| 3389 | Remote Desktop | 5.71959 | Desktop access |
| 3128 | Squid Proxy | 3.88055 | Spam |
| 8080 | potential HTML proxy | 3.82993 | Spam |
| 3306 | MySQL | 3.74557 | Data compromise |
| 445 | SMB | 1.56909 | File compromise |
| 103 | ? | 1.48473 | |
| 8888 | potential HTML proxy? | 1.45099 | Spam |
| 110 | POP3 | 1.36663 | E-Mail compromise, spam |
| 20 | FTP-data | 1.33288 | FTP exploit? |
| 8000 | DVR control port | 1.14729 | DVR access |
| 3398 | ? | 1.14729 | |
| 79 | finger | 1.13042 | User identity leak |
| 789 | ? | 1.09668 | |
| 3397 | ? | 1.0798 | |
| 119 | nntp | 1.06293 | NNTP exploit |
| 3396 | ? | 1.04606 | |
| 21 | FTP | 1.04606 | File compromise |
| 465 | smtps | 1.02919 | Spam |
sub usbreset($) {
my ($device)=@_;
use File::Slurp;
require 'sys/ioctl.ph';
my ($rdev)=(stat($device))[6];
return if !$rdev;
my ($major,$minor)=($rdev>>8,$rdev&255);
my $path="/sys/dev/char/$major:$minor/../../../..";
my $bus=read_file("$path/busnum");
my $dev=read_file("$path/devnum");
my $ctl=sprintf('/dev/bus/usb/%03d/%03d',$bus,$dev);
open my $fd,'>',$ctl || return;
# USBDEVFS_RESET from linux/usbdevice_fs.h
my $res=ioctl($fd,_IO(ord('U'),20),0);
return if !defined $res;
return 1;
}
D. Lee, K. Lee, S. Yoo and J. K. K. Rhee, "Efficient Ethernet Ring Mesh Network Design," in Journal of Lightwave Technology, vol. 29, no. 18, pp. 2677-2683, Sept.15, 2011.