Sunday, 28 April 2013

cpanel scripts

> build_maxemails_config — Sets limits on the amount of email that users can send from domains on your server.
> easyapache — Upgrades and reinstalls Apache.
> phpextensionmgr — Manages PHP extensions.
> *up — Updates a service.
> bandminup — Bandmin application.
> courierup — Courier mail server.
> cpaddonsup — cPanel’s addon scripts.
> dovecotup — Dovecot mail server.
> eximup — Exim mail exchanger.
> ftpup — FTP servers (ProFTP and Pure-FTP).
> imapup — IMAP mail server.
> mysqlup —MySQL service.
> nsdup — BIND nameserver.
> phpup — Current version of PHP.
> suphpup — SuPHP tool for handling PHP requests.
> restartsrv_* — Restarts a service.

> apache — Apache web server.
> bind — BIND nameserver software.
> chkservd — cPanel’s TailWatch log processing service.
> clamd — ClamAV anti-virus software.
> courier — Courier mail server.
> cpdavd — cPanel’s WebDAV server.
> cppop — cPanel’s POP server.
> dovecot — Dovecot mail server.
> entropychat — Entropy chat client.
> exim — Exim mail exchanger.
> eximstats — Exim mail statistics tracker.
> ftpserver — FTP server.
> httpd — Apache web server.
> imap — IMAP server.
> inetd — Super-server daemon for managing Internet services.
> interchange — Interchange e-commerce software.
> ipaliases — IP aliasing software.
> melange — Melange chat client.
> mysql — MySQL database server.
> named — BIND nameserver software.
> nsd — Open-source NSD nameserver daemon.
> postgres — PostgresSQL database service.
> postgresql — PostgreSQL database service.
> proftpd — ProFTP server daemon.
> pureftpd — Pure-FTP server daemon.
> rsyslogd — Open-source log forwarder daemon.
> spamd — Spam-deferral daemon.
> sshd — Secure shell daemon.
> syslogd — Log forwarder daemon.
> tailwatchd — cPanel’s TailWatch log processing service.
> tomcat — Apache Tomcat service.
> xinetd — Open-source super-server daemon.
> addpop — Adds a POP account.
> delpop — Removes a POP account.
> wwwacct — Adds a cPanel account.
> killpkg — Removes a package.
> restorepkg — Restores a package.
> cpbackup — Backs up all accounts.
> setupmailserver — Allows you to switch between mailservers.
> setupftpserver — Allows you to switch between FTP servers.
> setupnameserver — Allows switching between DNS servers.
> checkperlmodules — Contains a list of standard CPAN modules to install on cPanel servers. This script is used in conjunction with realperlinstaller, below. This script can be used with the following arguments:
--force will reinstall everymodule regardless of whether or not it is working.
--full will ensure that all modules are present as opposed to only checking for essential modules.
> realperlinstaller — A wrapper script that automates the installation of Perl CPAN modules.
> suspendacct — Suspends an account.
> unsuspendacct — Unsuspends an account.
> runweblogs — Updates statistics for a user.
> runstatsonce — Updates statistics for all users.
> makecppphp — Re-installs cPanel’s internal PHP.
> portsup — Updates ports (FreeBSD® systems only).
> check_users_my_cnf — Check user accounts for ~/.my.cnf files that do not work and disable them. This script only returns output when it detects a bad .my.cnf.
> comparecdb — Compare the contents of 2 CDB files. You will need to specify the 2 CDB files you wish to compare after the script.
For example: /usr/local/cpanel/scripts/comparecdb $file1 $file2 (where the $file1 and $file2 represent the 2 files you wish to compare)
dumpcdb — Displays the contents of a CDB file. You will need to specify the CDB file you wish to view.
For example: /usr/local/cpanel/scripts/dumpcdb $file (where $file represents the file you wish to view)
> upcp-running — Specifies whether a upcp command is running.
> chkmydns — Performs a simple configuration check of MyDNS.
> exportmydnsdb — Exports zones from MyDNS for use with BIND and NSD.
> fixmailinglistperms — Repairs permissions for all mailing list files and directories.
> gather-update-logs — Sends update logs to cPanel for analysis.
> hook — Executes any hooks that would be called normally in the specified context.
> importmydnsdb — Imports zone information from BIND and NSD into MyDNS.
> mydnsup — Installs and updates MyDNS packages.
> restartsrv_mydns — Restarts script from MyDNS.
> slurp_exim_mainlog — Imports exim mainlog data into the eximstats database.
> update_php_timezonedb — Updates the timezone database used by PHP.
> xfer_horde_sid_resolver.pl — Resolves key collision errors before importing Horde data during an account transfer.
> installruby — Installs Ruby.
> installpostgres — Installs PostgreSQL.
> convert_roundcube_mysql2sqlite — Converts the Roundcube database from MySQL to SQLite.

Sunday, 21 April 2013

CSF Commands



To add IP address in to deny list

csf -d xxx.xxx.xxx.xxx

To add IP address in to allow list

csf -a xxx.xxx.xxx.xxx

How to restart csf firewall

csf -r

How to stop csf firewall

csf -x

Path of CSF configuration file on cPanel server

/etc/csf/csf.conf

Path of denied IP addresses file in CSF

/etc/csf/csf.deny

Path of allowed IP address file in CSF

/etc/csf/csf.allow

How to add IP address in to ignorelist

login to shell then add IP address in to /etc/csf/csf.ignore

How to find IP address blocked in temporary ban.

grep xxx.xxx.xxx.xxx /etc/csf/csf.tempban

Remove and unblock an IP address in /etc/csf.deny

csf -dr IP address

Remove an IP address from the temporary IP ban list

csf -tr IP address

Create File of a Given Size

To create a file of a given size such as 10M, use the below command in linux,

dd if=/dev/zero of=test.dat bs=1M count=10

you can use K/M/G as extension for bs.



To create a file of a given size such as 10M with random contents,

dd if=/dev/urandom of=test.dat bs=1M count=10

Argument list too long error for rm


Using wildcards such as * gives  arg list  too long error when there are lot of matches. Here we need to use pipe judiciously in such cases to overcome the limit.


You can use the below command in such situation to remove the files.

change to the prefered directory using cd  command and then run,

ls | xargs -n100 rm -f




Also, you can use find command in some situation  to change the directory/file permission like,


find . -type d -exec chmod 775 {} \; #Directory


find . -type f -exec chmod 664 {} \; #Files
 

Test credit card account numbers

While web testing, use only the credit card numbers listed here. Other numbers produce an error. Expiration date must be a valid date in the future.

American Express
371449635398431
American Express Corporate
378734493671000
Australian BankCard
5610591081018250
Diners Club
30569309025904
Diners Club
38520000023237
Discover
6011111111111117
Discover
6011000990139424
JCB
3530111333300000
JCB
3566002020360505
MasterCard
5555555555554444
MasterCard
5105105105105100
Visa
4111111111111111
Visa
4012888888881881
Visa
4222222222222
Note : Even though this number has a different character count than the other test numbers, it is the correct and functional number.
Processor-specific Cards
Dankort (PBS)
76009244561
Dankort (PBS)
5019717010103742
Switch/Solo (Paymentech)
6331101999990016

Thursday, 18 April 2013

NMap

Nmap

>> Nmap ("Network Mapper") is a free and open source (license) utility for network discovery and security auditing. 

>> Useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime.

>> nmap --version : Provided nmap version details if it is installed.

>> Nmap has traditionally been a command-line tool run from a Unix shell or (more recently) Windows command prompt.

>> Many graphical frontends have been created for those users who prefer a GUI interface. Nmap has traditionally included a simple GUI for Unix named NmapFE, but that was replaced in 2007 by Zenmap.

Installation via Source:

>> Download nmap source from http://nmap.org/dist/?C=M&O=D
>> Decompress the downloaded tarball.
>> Change into the newly created directory
>> ./configure
>> make
>> make instal


NMap Commands:

Scan a single host or an IP address:

nmap <IP/Hostname>

namp 192.168.0.2
nmap test1.com

Scan multiple IP address or subnet:

nmap <IP1> <IP2> <IP3>

OR

nmap 192.168.0.1,2,3

OR 

nmap 192.168.0.1-15

OR

nmap 192.168.1.*

OR

nmap 192.168.1.0/24

Ref Url :



Tuesday, 16 April 2013

How to List installed perl module


Use instmodsh (interactive inventory for installed Perl modules) command to find out what modules already installed on my system. instmodsh command provides an interactive shell type interface to query details of locally installed Perl modules.
 
To display the list enter the following command:
$ instmodsh

This will show the below options,
 
Available commands are:
l - List all installed modules
m - Select a module
q - Quit the program
cmd?

type l to list all installed modules:cmd? l
Installed modules are:
Archive::Tar
CPAN
Class::Spiffy
Compress::Zlib
Cwd
Digest::SHA
IO::Zlib
MIME::Lite
Module::Build
Module::Signature
Net::Telnet
PAR::Dist
Perl
Spiffy
Term::ReadLine
Test::Base
Test::Simple
Text::Glob
Weather::Com
XML::Simple
YAML
cmd?
 
This command itself is a perl script that use ExtUtils::Installed module. type q to exit.

Thursday, 11 April 2013

Find And Replace Text with VI


Both vi and vim text editor comes with substitute command for finding and replacing text.

Syntax

:%s/WORD-To-Find-HERE/Replace-Word-Here/g
OR
:%s/FindMe/ReplaceME/g

Examples

The substitute command can be used as per your requirements.

VI / Vim Basic Find and Replace

To find each occurrence of 'UNIX', and replace it with 'Linux', enter (press ESC, type : and following command)::%s/UNIX/Linux/g

Find and Replace with Confirmation

Find a word called 'UNIX' and replace with 'Linux', but ask for confirmation first, enter:
:%s/UNIX/Linux/gc

Find and Replace Whole Word Only

Find whole words exactly matching 'UNIX' to 'Linux'; and ask for confirmation too:
:%s/\<UNIX\>/Linux/gc

Case Insensitive Find and Replace

Find 'UNIX' (match UNIX, unix, UnIx, Unix and so on) and replace with 'Linux':
:%s/unix/Linux/gi
Same command with confirmation:
:%s/unix/Linux/gic

Case sensitive Find and Replace

Find each 'UNIX' and replace with 'bar':
:%s/UNIX/bar/gI
Same command with confirmation:
:%s/UNIX/bar/gIc

Replace In the Current Line Only

Find 'UNIX' and replace with 'Linux' in the current line only (note % is removed from substitute command):
:s/UNIX/Linux/g
NOTE: You need to prefix % the substitute command to make changes on all lines:
:%s/UNIX/Linux/g

Replace All Lines Between line 100 and line 250

:{START-n},{END-n}s/word1/word2/g
Find 'UNIX' and replace with 'Linux' all lines between line 100 and line 250, enter:
:100,200s/UNIX/Linux/g
OR
:100,200s/UNIX/Linux/gc