博文

目前显示的是标签为“Linux”的博文

About Netgear WNDR4300v1 5GHz missing problem

After flashing OpenWRT to Netgear WNDR4300v1, I surprisingly found that 5GHz wireless card was missing. And I tried to flash back to OEM version but ended up in dead loop rebooting. The 5GHz wifi of WNDR4300 is provided by AR9580 which is connected by the PCI interface. I used dmesg to inspect the log of openwrt and found that PCI found nothing when starting. Was the chip broken? I nearly gave up and tried to disconnect the router with its power and went to dinner. After the dinner, I powered up the router and -- it just worked! Here is the log from dmesg. [     0.391671] PCI host bridge to bus 0000:00 [     0.396044] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff] [     0.403409] pci_bus 0000:00: root bus resource [io   0x0000] [     0.409340] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0] [     0.416575] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]...

Use Nmap to Scan Ports (cheat sheet)

1.Basic scan nmap 41.22.10.1 nmap yourdomain.com 2.Scan specific ports nmap -p 1-65535 41.22.10.1 nmap -p 1,443 41.22.10.1 3.Scan multipul ips nmap 1.1.1.1 1.1.1.2 nmap 1.1.1.1,2,3,4 (This will scan 1.1.1.1 1.1.1.2 1.1.1.3 1.1.1.4) nmap 1.1.1.1-4 nmap 1.1.1.* nmap 1.1.1.0/28 4.Scan popular ports nmap --top-ports 20 1.1.1.1 (Scan 20 ports of 1.1.1.1) 5.Scan target from a file nmap -iL list.txt 6.Scan an Service detection nmap -A -T4 1.1.1.1 (-A is for service detection. -T4 speeds up this operation) 7.Detect Service/Daemon nmap -sV 1.1.1.1 8.Scan using UDP/TCP nmap -sT 1.1.1.1 (For TCP) nmap -sU 1.1.1.1 (For UDP) 9.Vulnerability detection nmap -Pn --script vuln 1.1.1.1 10.Launch DOS Attack nmap 1.1.1.1 -max-parallelism 800 -Pn --script http-slowloris --script-args http-slowloris.runforever=true 11.Lauch brute force attacks nmap -sV --script http-wordpress-...

Create ubifs volumes in Linux (OpenWRT)

When using a router flashed with OpenWRT, you may find that the capacity of the filesystem is much smaller than the real capacity. For example, the router I use is Netgear WNDR4300 which has a 128MB Nand flash. But when using the 'df -h' command to inspect the space usage status, I surprisingly found that the space of the total mounting point '/' is only 14MB. So to find out the reason and try to expand usable space, I used the command "dmesg" and "cat /proc/mtd" to collect the information of mtd devices. [     0.634792] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xf1 [     0.641287] nand: Micron NAND 128MiB 3,3V 8-bit [     0.645888] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 [     0.653625] Scanning device for bad blocks [     0.661590] random: fast init done [     0.744785] 12 cmdlinepart partitions found on MTD device ar934x-nfc [     0.751249] Creating 12 MT...

Connecting via shadowsocks socks5h via Linux command line

Please note that here we use socks5h instead of socks5. socks5h is a specified version of socks5 which means solve host name via proxy too. export http_proxy="socks5h://192.168.31.114:1081" export https_proxy=$http_proxy

Why cannot mysqld be found?

In some LAMP server, you may be confused that mysqld service cannot be found. For example, when using the command: > sudo service msyqld restart It just failed and said something like mysqld.service didn't exist. When this happens, please try: >sudo service  mariadb restart Hope this will help.

Use proxy chains to access socks proxy in command line in 3 steps - Linux

Step 1. Install sudo apt-get install proxychains Step 2. Config port sudo vim /etc/proxychains.conf Step 3. Usage proxychains <your command>

MongoDB study note (2): security configurations - Setup username and password, Bind interface and Iptables (on Ubuntu 16.04/mongoDB 3.4)

Setting up username and password First, check your /etc/mongod.conf to confirm it is not in the auth mode. Add comment symbol '#' of the following code and restart mongod service: #security:   #authorization: enabled sudo service mongod restart Then, Connect to local mongodb: mongo --port 27017 Switch to admin database: use admin Create admin user: db.createUser({ user: "admin", pwd: "<your password>", roles: [{ role: "userAdminAnyDatabase", db: "admin" }] }) Grant Roles: db.grantRolesToUser('admin',[{ role: "root", db: "admin" }]) Check if successfully added (should return 1): db.auth("admin", "<your password>") Exit mongo client: exit Enable the auth mode in your /etc/mongod.conf by activating the following lines and then restart the service: security:   authorization: enabled sudo service mongod restart Go back to...

MongoDB study note (1): Installation and Run (on Ubuntu 16.04/MongoDB 3.4)

Installation Command list: (Ubuntu 16.04 for example. Other systems please refer to https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/) sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list sudo apt-get update sudo apt-get install -y mongodb-org Run Command list: sudo service mongod start

How to deal with the ERROR: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open “/var/lib/dbus/machine-id”

After I deployed the scrapy-splash, I ran my spider and encountered an ERROR: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open “/var/lib/dbus/machine-id” It seemed that no affection to the results but really annoying. After I tried a few solutions from Google, finally I solved it with this command: dbus-uuidgen > /var/lib/dbus/machine-id Good Luck!

Using Haproxy + shadowsocks (ha + ss) to setup multi ss backend and load balance

*Install haproxy > sudo apt-get install haproxy *Configure haproxy >vim /etc/haproxy/haproxy.cfg global     ulimit-n 51200     log /dev/log local0     log /dev/log local1 notice     chroot /var/lib/haproxy     pidfile /var/run/haproxy.pid     user haproxy     group haproxy     daemon defaults     log global     mode tcp     option dontlognull     timeout connect 5000       timeout client 50000     timeout server 50000 frontend ss-in     mode tcp       bind $Your_IP:8002     default_backend shadowsocks backend shadowsocks     mode tcp       balance roundrobin         server ss1 $Your_SS_IP1:$Your_SS_PORT1 maxconn 20480         server ss2 $Your_SS_IP2:$Your_SS_PORT2 maxconn 20480 ...

Setup shadowsocks in Ubuntu 16.04 server [client & server]

1.  Setup Server *Install shadowsocks > apt-get install shadowsocks *Configure config file in /etc/shadowsocks/config.json {     "server":"Your server ip",     "server_port":your server port,     "local_address": "127.0.0.1",     "local_port":1080,     "password":"You Password",     "timeout":300,     "method":"aes-256-cfb",     "fast_open": false,     "workers": 1 } *Restart service > sudo /etc/init.d/shadowsocks restart 2. Setup Client *Install shadowsocks client >sudo apt-get install python-pip >sudo pip install shadowsocks *Create config file in /etc/shadowsocks.conf.json {     "server":"Your server ip",     "server_port":your server port,     "local_address":"your local ip",     "local_port":your local port,     "pas...