自由學習的風

幽夢影 張潮 少年讀書,如隙中窺月;中年讀書,如庭中望月;老年讀書,如臺上玩月。皆以閱歷之淺深,為所得之淺深耳。

[批次檔] for 迴圈的變數利用方式

2018年1月27日 星期六

在 Windows 寫批次檔,利用  for 指令跑迴圈取得檔案資訊時,可以使用的修飾元

%~I         - expands %I removing any surrounding quotes (")
%~fI        - expands %I to a fully qualified path name
%~dI        - expands %I to a drive letter only
%~pI        - expands %I to a path only
%~nI        - expands %I to a file name only
%~xI        - expands %I to a file extension only
%~sI        - expanded path contains short names only
%~aI        - expands %I to file attributes of file
%~tI        - expands %I to date/time of file
%~zI        - expands %I to size of file
%~$PATH:I   - searches the directories listed in the PATH
               environment variable and expands %I to the
               fully qualified name of the first one found.
               If the environment variable name is not
               defined or the file is not found by the
               search, then this modifier expands to the
               empty string

%~dpI       - expands %I to a drive letter and path only
%~nxI       - expands %I to a file name and extension only
%~fsI       - expands %I to a full path name with short names only
%~dp$PATH:I - searches the directories listed in the PATH
               environment variable for %I and expands to the
               drive letter and path of the first one found.
%~ftzaI     - expands %I to a DIR like output line

障礙不障礙

2018年1月24日 星期三

個人看法:
現行的無障礙規範對網頁設計的影響,有時不是簡單的讓有障礙的人無障礙,影響更大的是網頁設計人員、網站網理人員、平台使用人員, 2.0 的後續反應,可能會變成

反應一:完全不管障不障礙

反應二:符合無障礙,承辦人累得要死…

反應三:符合無障礙,但是為了不爆肝,所以…

  • 資料變成要登入才看得到
  • 網站會盡量不變動
  • 公告的話,盡量用純文字
  • 活動花絮、照片、影片之類的改成 youtube、google photo 或是 fb 粉絲團,讓人加入自己去訂閱

[轉] 開源的弱掃工具 - Archery

2018年1月19日 星期五

原文:Archery - Open Source Vulnerability Assessment And Management Helps Developers And Pentesters To Perform Scans And Manage Vulnerabilities


---------------------------------------------------------
Requirement

Installation
$ git clone https://github.com/anandtiwarics/archerysec.git
$ cd /archerysecurity
$ pip install -r requirements.txt
$ python manage.py collectstatic
$ python manage.py makemigrations networkscanners
$ python manage.py makemigrations webscanners
$ python manage.py makemigrations projects
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver
Note: Make sure these steps (except createsuperuser) should be perform after every git pull.

Setup Setting
Zap Setting
  1. Go to Setting Page
  2. Edit ZAP setting or navigate URL : http://host:port/setting_edit/
  3. Fill all required information and click on save.

[轉] How to Install Arch Linux [Step by Step Guide]

2018年1月17日 星期三

文章出處:https://itsfoss.com/install-arch-linux/

整理步驟大致如下:詳文請至文章出處瀏覽
Step 1: Download the ISO
Step 2: Create a live USB of Arch Linux
Step 3: Boot from the live USB
Step 4: Partitioning the disks
Step 5: Creating filesystem
Step 6: Installation
Step 7: Configuring the system
Step 8. Setting Timezone
Step 9. Setting up Locale.
Step 10. Installing bootloader, setting up hostname and root password
Step 11: Install a desktop environment (GNOME in this case)

[轉貼] hosts.deny - Linux Command - Unix Command

寫得非常詳盡

文章出處:https://www.lifewire.com/hostsdeny-linux-command-4094617

[Ubuntu] 單網卡多個IP

1. 臨時性
sudo ip address add <ip-address>/<netmask> dev <interface>
例:
sudo ip address add 10.231.141.231/24 dev eth0

2. 永久性 /etc/network/interfaces
iface eth0 dhcp
iface eth0 inet static
    address 10.231.141.231/24
iface eth0 inet static
    address 10.241.141.231/24

重新啟動
sudo ifdown eth0 && sudo ifup eth0

補充:The iproute2 suite:
The iproute2 suite is the communication suite for interprocess communication beween the kernel and the user space via the netlink protocol. It should replace the whole standard network tools. Here is what they replace:
  • ifconfig --> ip addr and ip link
  • route --> ip route
  • arp --> ip neigh
  • iptunnel --> ip tunnel
  • ipmaddr --> ip maddr
  • netstat --> ss

odt 轉檔

2018年1月14日 星期日

準備找時間來實作一下…

參考資料:

[IPv6] 透過 IPv6 掛載網路磁碟

2018年1月10日 星期三

IPv4 掛載網路磁碟大家比較常用,應該沒什麼問題,但是 IPv6 就比較少碰到,上次好奇查了一下,才知道怎麼用,規則不難,但是一開始會覺得有點不適應…

  1. 把冒號(:) 換成減號(-)
  2. 把百分比符號(%)換成英文字母(s)
  3. 結尾加上 .ipv6-literal.net
例:
2001:4898:9:3:c069:aa97:fe76:2449
2001-4898-9-3-c069-aa97-fe76-2449.ipv6-literal.net
net use z: \\2001:4898:9:3:c069:aa97:fe76:2449.ipv6-literal.net\share 


IPv6轉換網站: http://ipv6-literal.com/
Microsoft: How do I create a UNC to an IPv6 address?

[linux] 轉:語系設定 locale

2018年1月9日 星期二

講解的很清楚,值得看!

參考網址:https://moto.debian.tw/viewtopic.php?t=6213

[Linux] RHEL 6 vs. 7

新的學校首頁系統即將更換,Linux 系統會提供 CentOS的虛擬機;先來熟悉一下 Redhat 系的操作。
看起來 RHEL 6 比較接近 Ubuntu 14.04,RHEL 7則接近 Ubuntu 16.04,

Ref:

  1. https://arkit.co.in/rhel-6-vs-rhel-7-difference-previous-newer-version/
  2. http://simplylinuxfaq.blogspot.tw/p/major-difference-between-rhel-7-and-6.html
Feature NameRHEL 6RHEL 7
Default File SystemExt4XFS
Kernel Version2.6.xx3.10.xx
Release NameSantiagoMaipo
Gnome VersionGNOME 2GNOME 3.8
KDE VersionKDE 4.1KDE 4.6
Release DateWednesday, November 10, 2010Tuesday, June 10, 2014
NFS VersionNFS 4NFS 4.1. NFS V2 is deprecated in RHEL 7
Samba VersionSMB 3.6SMB 4.4
Default DatabaseMySQLMariaDB
Cluster Resource ManagerRgmanagerPacemaker
Network InterfaceGroupingBonding can be done as Active-Backup, XOR, IEEE and Load Balancing Team Driver will support multiple types of Teaming methods called Active-Backup, Load-balancing and Broadcast
KDUMPKdump does't support with large RAM Size RHEL 7 can be supported up to 3TB
Boot LoaderGrub 2
/boot/grub2/grub.cfg
Grub 0.97
/boot/grub/grub.conf
File System Checke2fsck
-Inode check. Block and size check
–Directory Structure check
-Directory Link Check
-reference count check
-Group Summary Check 
 xfs_replair
– Inode blockmap checks
-Inode allocation map checks
-Inode size check
-Directory check
-Path Name check
-Link count check
-Freemap check
-Super block check
Process IDInitd  Process ID 1 Systemd Process ID 1
Port SecurityIptables by default service port is enabled when service is switched on. Firewalld instead of iptables. Iptables can also support with RHEL 7, but we can't use both of them at the same time. Firewall will not allow any port until and unless you enabled it.
Boot Time40 Sec20 Sec
File System SizeEXT4 16TB with XFS 100TBXFS 500TB with EXT4 16TB
Processor Architecture32Bit and 64BitOnly 64Bit.
Network Configuration Toolsetupnmtui
Host name Config File/etc/sysconfig/network/etc/hostname No need to edit hostname file to write permanent hostname simply use hostnamectl command
Interface Nameeth0ens33xxx
Managing Servicesservice sshd start
service sshd restart
chkconfig sshd on
systemctl start sshd.service
systemctl restart sshd.service
systemctl enable sshd.service
System Logs/var/log//var/log
journalctl
Run Levelsrunlevel 0 – Power Off
runlevel 1 – Single User Mode
runlevel 2 – Multi User without Networking
runlevel 3 – Multi User CLI
runlevel 4 – Not USed
runlevel 5 – GUI Mode
runlevel 6 – Restart
There is no run levels in RHEL 7. Run levels are called as targets
Poweroff.target
rescue.target
multi-user.target
graphical.target
reboot.target
UID InformationNormal User UID will start from 500 to 65534
System Users UID will start from 1 to 499
Normal User UID start from 1000 – 65534
System Users UID will start from 1 to 999Because Services are increased compare to RHEL 6
By Pass Root Password Promptappend 1 or s or init=/bin/bash to Kernel command lineAppend rd.break or init=/bin/bash to kernel command line
Rebooting and Poweroffpoweroff – init 0
reboot – init 6
systemctl poweroff
systemctl reboot
YUM Commandsyum groupinstall
yum groupinfo
yum group install
yum group info

FeaturesRHEL 7RHEL 6
Default File SystemXFSEXT4
Kernel Version3.10.x-x kernel2.6.x-x Kernel
Kernel Code NameMaipoSantiago
General Availability Date of First Major Release2014-06-09 (Kernel Version 3.10.0-123)2010-11-09 (Kernel Version 2.6.32-71)
First Processsystemd (process ID 1)init (process ID 1)
Runlevelrunlevels are called as "targets" as shown below:

runlevel0.target -> poweroff.target
runlevel1.target -> rescue.target
runlevel2.target -> multi-user.target
runlevel3.target -> multi-user.target
runlevel4.target -> multi-user.target
runlevel5.target -> graphical.target
runlevel6.target -> reboot.target

/etc/systemd/system/default.target (this by default is linked to the multi-user target)
Traditional runlevels defined :

runlevel 0
runlevel 1
runlevel 2
runlevel 3
runlevel 4
runlevel 5
runlevel 6

and the default runlevel would be defined in "/etc/inittab" file.
Host Name Change
In Red Hat Enterprise Linux 7, as part of the move to the new init system (systemd), the hostname variable is defined in "/etc/hostname" file.
In Red Hat Enterprise Linux 6, the hostname variable was defined in the "/etc/sysconfig/network" configuration file.
Change In UID AllocationBy default a new user created would get UIDs assigned starting from 1000.

This could be changed in "/etc/login.defs" file if required.
Default UID assigned to users would start from 500.


This could be changed in "/etc/login.defs" file if required.
Max Supported File Size
Maximum (individual) file size = 500TB
Maximum filesystem size = 500TB

(This maximum file size is only on 64-bit machines. Red Hat Enterprise Linux does not support XFS on 32-bit machines.)
Maximum (individual) file size = 16TB
Maximum filesystem size = 16TB

(This maximum file size is based on a 64-bit machine. On a 32-bit machine, the maximum files size is 8TB.)
File System Check
"xfs_repair"

XFS does not run a file system check at boot time.
"e2fsck"

File system check would gets executed at boot time.
Differences Between xfs_repair & e2fsck
"xfs_repair"

- Inode and inode blockmap (addressing) checks.
- Inode allocation map checks.
- Inode size checks.
- Directory checks.
- Pathname checks.
- Link count checks.
- Freemap checks.
- Super block checks.

"e2fsck"

- Inode, block, and size checks.

- Directory structure checks.

- Directory connectivity checks.

- Reference count checks.

- Group summary info checks.
Difference Between xfs_growfs & resize2fs"xfs_growfs"

xfs_growfs takes mount point as arguments.
"resize2fs"

resize2fs takes logical volume name as arguments.
Change In File System Structure/bin, /sbin, /lib, and /lib64 are now nested under /usr./bin, /sbin, /lib, and /lib64 are usually under /
Boot Loader
GRUB 2
Supports GPT, additional firmware types, including BIOS, EFI and OpenFirmware. Ability to boot on various file systems (xfs, ext4, ntfs, hfs+, raid, etc)
GRUB 0.97
KDUMPRHEL7 supports kdump on large memory based systems up to 3 TBKdump doesn't work properly with large RAM based systems.
System & Service Manager"Systemd"

systemd is a system and service manager for Linux, and replaces SysV and Upstart used in previous releases of Red Hat Enterprise Linux. systemd is compatible with SysV and Linux Standard Base init scripts.
Upstart
Enable/Start ServiceFor RHEL 7, the systemctl command replaces service and chkconfig.

- Start Service : "systemctl start nfs-server.service".

- Enable Service : To enable the service (example: nfs service ) to start automatically on boot : "systemctl enable nfs-server.service".

Although one can still use the service and chkconfig commands to start/stop and enable/disable services, respectively, they
are not 100% compatible with the RHEL 7 systemctl command 
Using "service" command and "chkconfig" commands.

- Start Service : "service start nfs" OR "/etc/init.d/nfs start"

- Enable Service : To start with specific runlevel : "chkconfig --level 3 5 nfs on"
Default Firewall
"Firewalld (Dynamic Firewall)"

The built-in configuration is located under the "/usr/lib/firewalld" directory. The configuration that you can customize is under the "/etc/firewalld" directory. It is not possible to use Firewalld and Iptables at the same time. But it is still possible to disable Firewalld and use Iptables as before.
Iptables
Network Bonding"Team Driver"

-/etc/sysconfig/network-scripts/ifcfg-team0
- DEVICE=」team0」
- DEVICETYPE=」Team」
"Bonding"

-/etc/sysconfig/network-scripts/ifcfg-bond0
- DEVICE=」bond0」
Network Time SynchronizationUsing Chrony suite (faster time sync compared with ntpd)Using ntpd
NFSNFS4.1
NFSv2 is no longer supported. Red Hat Enterprise Linux 7 supports NFSv3, NFSv4.0, and NVSv4.1 clients.
NFS4
Cluster Resource ManagerPacemakerRgmanager
Load Balancer TechnologyKeepalived and HAProxyPiranha
Desktop/GUI InterfaceGNOME3 and KDE 4.10GNOME2
Default DatabaseMariaDB is the default implementation of MySQL in Red Hat Enterprise Linux 7MySQL
Managing Temporary FilesRHEL 7 uses systemd-tmpfiles (more structured, and configurable, method to manage tmp files and directories).Using "tmpwatch"