分类 默认分类 下的文章

config for minTTY

color redefine

minTTY终端可以重新定义ANSI颜色值

echo -ne '\e]4;0;#000000\a'   # black
echo -ne '\e]4;1;#BF0000\a'   # red
echo -ne '\e]4;2;#00BF00\a'   # green
echo -ne '\e]4;3;#BFBF00\a'   # yellow
echo -ne '\e]4;4;#0000BF\a'   # blue
echo -ne '\e]4;5;#BF00BF\a'   # magenta
echo -ne '\e]4;6;#00BFBF\a'   # cyan
echo -ne '\e]4;7;#BFBFBF\a'   # white (light grey really)
echo -ne '\e]4;8;#404040\a'   # bold black (i.e. dark grey)
echo -ne '\e]4;9;#FF4040\a'   # bold red
echo -ne '\e]4;10;#40FF40\a'  # bold green
echo -ne '\e]4;11;#FFFF40\a'  # bold yellow
echo -ne '\e]4;12;#6060FF\a'  # bold blue
echo -ne '\e]4;13;#FF40FF\a'  # bold magenta
echo -ne '\e]4;14;#40FFFF\a'  # bold cyan
echo -ne '\e]4;15;#FFFFFF\a'  # bold white

参考资料

  • https://en.wikipedia.org/wiki/ANSI_escape_code
  • https://github.com/mintty/mintty/wiki/Tips

arch系统安装chromium

搜索/安装chromium

$ pacman -Ss chromium
extra/chromium 65.0.3325.181-7
$ pacman -S chromium

直接运行chromium尽然无反应,命令行中运行出现如下错误

$ chromium
/usr/lib/chromium/chromium: error while loading shared libraries: libicui18n.so.61: cannot open shared object file: No such file or directory

想也不想就安装ICU(没考虑兼容性 pacman -Su icu)

$ pacman -S icu

结果发现chromium还是无法启动并且pacman命令失败

pacman: error while loading shared libraries: libicuuc.so.58: cannot open shared object file: No such file or directory

需要降级ICU,以便恢复pacman,但ICU不兼容导致很多系统命令失败。
最后发现一个办法:使用一个LiveCD系统(基本功能)对目前的系统进行修复

记住现在的磁盘分区挂载情况

$ df -h
dev              /dev
run              /run
/dev/sda3        /
tmpfs            /dev/shm
tmpfs            /sys/fs/cgroup
tmpfs            /tmp
/dev/sda1        /boot
/dev/sda5        /data
/dev/sda6        /home
/dev/sda4        /var
tmpfs            /run/user/120
tmpfs            /run/user/1000
/dev/sdb         /mnt/usb

这里相关的分区是两个 /dev/sda3(根)和 /dev/sda4(var)

下载Bootstrap

$ wget -O http://mirrors.edge.kernel.org/archlinux/iso/2018.04.01/archlinux-bootstrap-2018.04.01-x86_64.tar.gz
$ tar zxf archlinux-bootstrap-2018.04.01-x86_64.tar.gz; ls
archlinux-bootstrap-2018.04.01-x86_64.tar.gz  root.x86_64

进入临时系统,挂载旧系统镜像

$ cd root.x86_64
$ bin/arch-chroot `pwd`
$ pacman-key --init
$ pacman-key --populate archlinux
$ mkdir /mnt/sys
$ mount /dev/sda3 /mnt/sys
$ mount /dev/sda4 /mnt/sys/var

安装(降级)ICU

$ cd /mnt/sys/var/cache/pacman/pkg/
$ pacman -r /mnt/sys -S icu-59.1-2-x86_64.pkg.tar.xz

上述命令意味Bootstrap系统里将icu59安装到/mnt/sys也就是之前的根

结论

之所以出现软件不兼容,是因为系统长时间没有滚动升级了

$ pacman -Syyu

ARCH VIM support clipboard

ArchLinux 上的 vim 不支持 x11,所以用vim打开的文件无法与外部程序共享剪切板。于是在arch的论坛上找到了利用abs编译打包vim的步骤。过程记录如下:

  1. 找到与现在系统兼容的版本
$ pacman -Q vim
vim 8.0.1272-1
  1. 因为ABS(archlinux build system) 已经不支持了,所以用svn (本次时packages包,有时是community)
$ svn co --depth=empty svn://svn.archlinux.org/packages
$ svn co --depth=empty svn://svn.archlinux.org/community
  1. 下载合适版本build,https://github.com/vim/vim/releases?after=v8.0.1282
$ cd packages
$ svn up -r308931 vim
$ cd vim/repos/extra-x86_64
  1. 修改PKGBUILD文件
  • --with-x= [no] yes
  • pkgname=('vim' ['gvim' 'vim-runtime'])
  1. 打包并安装
$ makepkg -s
$ pacman -U vim-8.0.1272-1-x86_64.pkg.tar.xz

暗网攻击步骤

  1. create a new site or login to an old one
  2. login and set sftp password
  3. login via sftp and create a symlink to /
  4. disable DirectoryIndex in .htaccess
  5. enable mod_autoindex in .htaccess
  6. disable php engine in .htaccess
  7. add text/plain type for .php files in .htaccess
  8. have fun browsing files
  9. find /home/fhosting
  10. look at the content of the index.php file in /home/fhosting/www/
  11. find configuration in /home/fhosting/www/_lbs/config.php
  12. copy paste database connection details to phpmyadmin login
  13. find active users with shell access in /etc/passwd
  14. look through the scripts and figure out how password resets work
  15. manually trigger a sftp password reset for the user ‘user’
  16. connect via ssh
  17. run ‘sudo -i’
  18. edit ssh config in /etc/ssh/sshd_config to allow root login
  19. run ‘passwd’ to set root password
  20. reconnect via ssh as root
  21. enjoy