Tikejhya: Ashish Nepal


Category: Uncategorised


Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

nmap -p- -Pn -n

-p-: you can specify -p- to scan ports from 1 through 65535.

-Pn: Treat all hosts as online — skip host discovery

-n/-R: Never do DNS resolution/Always resolve [default: sometimes]


nmap -sV -T4 -p-65535

Adding the -sV option enables Nmap version detection, which is trained to look for these clues (among others).

-T4 prohibits the dynamic scan delay from exceeding 10 ms for TCP ports and -T5 caps that value at 5 ms.

-p-65535: scan all ports to 65535

Reference to values for T: T Table

You have already voted.


Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Netdiscover is a simple ARP scanner which can be used to scan for live hosts in a network.

Discover your network interface eth0 for range of
netdiscover -i eth0 -r device: your network device


Options available:

  -r range: scan a given range instead of auto scan.,/16,/8
  -l file: scan the list of ranges contained into the given file
  -p passive mode: do not send anything, only sniff
  -m file: scan the list of known MACs and host names
  -F filter: Customize pcap filter expression (default: "arp")
  -s time: time to sleep between each arp request (miliseconds)
  -n node: last ip octet used for scanning (from 2 to 253)
  -c count: number of times to send each arp reques (for nets with packet loss)
  -f enable fastmode scan, saves a lot of time, recommended for auto
  -d ignore home config files for autoscan and fast mode
  -S enable sleep time supression betwen each request (hardcore mode)
  -P print results in a format suitable for parsing by another program
  -N Do not print header. Only valid when -P is enabled.
  -L in parsable output mode (-P), continue listening after the active scan is completed

You have already voted.

Chef Basics [Knife]

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

#save cookbook changes
knife cookbook upload tike_web

#Show role
knife role show web

#list all client
knife node list

# show user specific databags
knife data bag show users ashnep

# show environment specific databags
knife data bag show prod prod_data

#Create cookbook
knife cookbook create filebeats

#test configuration
rubocop cookbooks/filebeats

#Upload cookbook
knife cookbook upload filebeats

#show node data
knife node show ashnep-test

#Chef bootstrap
-r RUN_LIST, –run-list RUN_LIST
–use-sudo-password (Perform a bootstrap operation with sudo; specify the password with the -P (or –ssh-password) option)

knife bootstrap -N web1.tikejhya.com -r "role[web]" --environment dev -x tikejhya --sudo --use-sudo-password -i ~/.ssh/my_prv

Magento admin user password hash

# Magento stores user password inside admin_user and hashing is done with some random key
#So here we are resetting password with somepass for user called username

UPDATE admin_user SET password=CONCAT(MD5('qXsomepass'), ':qX') WHERE username = 'username';

Mac OSX port forwarding

Mac OSX port forwarding

echo "rdr pass inet proto tcp from any to any port 80 -> port 8080" | sudo pfctl -ef -

odbc in centos

# centos
yum install mysql-connector-odbc

apt-get install libmyodbc

root@ip-10-0-1-82:~# odbcinst -q -s
root@ip-10-0-1-82:~# odbcinst -q -d
root@ip-10-0-1-82:~# odbcinst -j
unixODBC 2.2.14
DRIVERS…………: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size…….: 8
SQLLEN Size……..: 8
root@ip-10-0-1-82:~# isql -S testdb -U root -P somepassword

checking shared odbc libraries linked to isql for default directories…
strings: ”: No such file
trying /tmp/sql … no
trying /tmp/sql … no
trying /etc … OK
checking odbc.ini files
reading /root/.odbc.ini
[testdb] found in /root/.odbc.ini
found this section:
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
SERVER = localhost
USER = root
PASSWORD = somepassword
PORT = 3306
Charset = UTF8
looking for driver for DSN [testdb] in /root/.odbc.ini
found driver line: ” Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so”
driver “/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so” found for [testdb] in .odbc.ini
found driver named “/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so”
/usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so is an executable file
“SERVER” found, not using freetds.conf
SERVER is “localhost”

Configuration looks OK. Connection details:

DSN: testdb
odbc.ini: /root/.odbc.ini
Driver: /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Server hostname: localhost

Attempting connection as root …
+ isql testdb root somepassword -v
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |

nginx Restricting Access

Restricting Access using allow deny with satisfy Any.

Access can be allowed or denied based on the IP address of a client or by using HTTP basic authentication.

To allow or deny access from a certain set of addresses, or all addresses, use the allow and deny directives:

location / {
deny all;

Restricting access with allow deny can be complemented with use of http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html

which allows to use either IP based restriction or User password based authentication. This is one of the key feature in Apache and majority of we want to have simillar use case senario:

location / {
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;

So combining this two may look like this:

location / {
satisfy any;

deny all;

auth_basic "closed site";
auth_basic_user_file conf/htpasswd;

cronjob offset

How to setup cronjob with offset:

# This cron will execute every fifth minute.
1-59/5 * * * * echo "hello i am offsetting 1"
# This cron will execute every fifth minute which starts with 2nd minute hence, it would offset by 1 minute compared to above.
2-59/5 * * * * echo "hello i am offsetting 2"
# This cron will execute every fifth minute which starts with 3rd minute hence, it would offset by 2 minute compared to above.
3-59/5 * * * * echo "hello i am offsetting 3"

This can also be done using sleep 60; sleep 120; sleep 180;

awk values where second coloum matches

awk '$2==5' file

Powered by WordPress & Theme by Anders Norén