Wednesday, November 9, 2022

All Linux Commands

 *MOST USED

ls -List files in directory

ls -a List all files, including hidden ones

pwd -Show the directory currently working in

mkdir- [directory] Create a new directory

rm- [file_name] Remove a file

cd- [directory] Change working directory

mv- [file] [destination] Move file to new

 destination

cp- [file] [destination] Copy file to new destination

grep- [PATTERN] [FILE] Find lines containing [PATTERN] in [FILE]

less [filename]- Display the contents of a file or a command

output one page at a time



*NETWORK DIAGNOSTIC COMMANDS (CONT.)

hostname -Display hostname of computer

hostname –I (capital ‘i’ not lowercase “L”)- Display all IP addresses of computer

ifdown [options] -a|[device] -Shutdown network interface

ifup [options] -a | [device]- Start a network interface

traceroute [host]- Perform traceroute to [host]




*FILE COMMANDS (CONT.)

tar-Stands for for tape archive and is used used

to create archive and extract archived files

tar -cf --Create an archive with a given file name

tar –xvf [file_name]- Unarchive an archive.

x includes the eXtended attributes of the

files (metadata)

v is verbose mode

f tells tar what file/archive you are

unarchiving

-mv [file name] /path/to/new/location - Move a file to a new directory

cat [file1][file2] -Concatenate files and output


-di! [file_name_1] [file_name_2] -File compare, line by line (note: di ! is

-whitespace sensitive)

-echo [text]>>[file_name]- Echo prints arguments to standard output,

-‘>>’ redirects standard output to append to a-

file [file_name]- defines target file name

-locate [file_name]- Locate a file in the file system


curl [options] [URL]- Curl is used for transferring data from or to a

-server without user interaction. Curl is used

to download or upload data using HTTP,

HTTPS, SCP , SFTP , or FTP .

-wget [URL] -Download a file from a server



*FILE COMMANDS

FILE COMMAND

ls List files in directory

ls -a List all files, including hidden ones

pwd Show the directory currently working in

mkdir [directory] Create a new directory

rm [file_name] Remove a file

rm -r [directory_name] Remove a directory and files recursively

rmdir Remove an empty directory

cp [file_name1] [file_name2] Copy the contents of the first file to a new

destination, which can be in a second folder

cp -r [directory_name1]

[directory_name2]

Recursively copy the contents of the first

directory into the second directory

mv [file_name1] [file_name2] Move file_name1 to file_name2

ln -s /path/to/[file_name] [link_name] Create a symbolic link to a file

touch [file_name] Create a new file

head [file_name] Show the first 10 lines of a file

tail [file_name] Show the last 10 lines of a file

gpg -c [file_name] Encrypt a file

gpg [file_name.gpg] Decrypt a file

wc Print the number of words, lines, and bytes in

a file




*NETWORK DIAGNOSTIC COMMANDS


ifconfig/ip -Get the IP address, MAC address, and MTU of

available networks

ping [address] -&Send ICMP ECHO_REQUEST packets to In

network host at [address]

nslookup [address] -Use the IP address to discover a domain

name, or vice versa.

nettop -Monitor network activity, showing a list of

processes and corresponding process IDs

with network connections

netstat Display which ports are active on your

machine, their status, and what they're

connected to

dig [record type] [domain] - Gather information about a particular

domain. Try “dig txt google.com




*SSH (LOGIN)

ssh [IP address] -Connect to a host

ssh user@server -Connect to a server (default port 22)

ssh user@server -p other_port -Use a specific port declared in sshd_config

ssh user@server [command to run] -Run a command on a remote server

ssh-copy-id hostname_or_IP -Copy a unique key pair to server

ssh -i ~/.ssh/specific_ssh_fkey -Specify other ssh key for connection



*PIPES/REDIRECTION

> -Represents output redirection and redirects

output to a file and overwriting the file


>> -Redirects output to a file and appends the

redirected output rather than overwrites

< -Represents input redirection and redirects

the given input file

<< -Launch a file and and captures user input

until EOF

| (ex. command_1 | command_2 |

command_3)

-A Linux pipe is a form of redirection used to

combine two or more commands where the

output of one command acts as the input of

the next command in the sequence.






*SYSTEM INFORMATION


lshw | less -List all hardware and pipes to the less

command for easy reading and pagination

top -Display sorted information about

processes

free -Free shows system information such as

free memory and swap in kibibytes

swapon

 

s -Swap information

dmidecode |


 less -Summarize BIOS information

cat /etc/issue -The cat command shows information

about a given directory, in this cat /ect/

issue.

lspci (or -v for verbose) -Show information about all PCI

lsusb (or -v for verbose) -Show information about all usb devices.

df –m -Display free storage in megabytes

du Return disk usage

du –h [directory] &Return disk usage in a readable file size 

format Eg. 1.1K or 15M 1.5G (-m shows file

in megabytes and -g shows a file in

gigabytes)

sudo systemctl restart [service_name] Restart a service

Eg. sudo systemctl restart apache2

kill [pid] Terminate a process. Use the ‘top’

command to find the pid of a process

pstree Display a tree of running processes

pmap –x PID [pid] Display memory information about a

process

cat /proc/cpuinfo Display detailed information about the

CPU





*USER CONTROLS AND MANAGEMENT USER WARNING: SOME OF

THESE COMMANDS CAN BE DANGEROUS. USE WITH CAUTION. 


useradd [user_name] Create a new user

useradd –r [user_name] -Delete a user

passwd Change your password

chown user:group /path/to/file -Change ownership of a file

chown –R user:group /path/to/directory -Change the ownership of a directory and

files

chmod [permission] [file_name] -Change the permissions of a file

Eg. chmod 777 /path/to/file

quit Logout

w -Display currently logged in users

chroot [path] [command] -Change the root directory of a process

finger [username] -Display information about a user

groups [username] -Display the groups a user belongs to

sudo passwd root Set a new password for the root user,

can be used to circumvent the sudo

command

(sudo) service ssh start Start ssh service

(sudo) service ssh status Check ssh service status

(sudo) service ssh stop Stop ssh service

(sudo) service ssh restart Restart ssh service




*OTHER



history Display prior used commands

[tab] -Autocomplete command you are typing, if

autocomplete has been configured for

your shell session

.

man [command name] -Display the manual or help file for a

command

clear Clear all information from the terminal 

window. Not useful for security.

env -Display environment variables

export [variable_name]=[variable_value] -Create a new environment variable

unset [variable_name] Remove environment variable

at [-V] [-q queue] [-f file] [-mldbv] &TIME Run a command at a specific time

crontab –e Create a new crontab or edit an existing

crontab

date Display current system date and time

iostat List CPU and I/O statistics

alias [new command name]=[command] Create a temporary alias for a command

shutdown Turns a computer o"




#aivel 

#Hacking 

Saturday, October 29, 2022

Malicious software

 •Malicious software

In many cases, the purpose of social engineering is to install malicious software, also

known as malware, on a device to provide an advantage to an adversary. Sometimes the

purpose is to cause damage to a target system or to spy on the end user. Ransomware

is increasing in popularity because it is generating direct revenue for attackers, unlike

stealing credentials where the theft itself is only part of the chain necessary for an attacker

to monetize their exploits. There are many types of malicious software. Some of the major

categories are as follows:

• Viruses

• • Worms

• Trojans

• • Ransomware

• Spyware

• Many people get confused by the differences between similar malicious software types. 

• Let's start with viruses.

*Viruses-

Computer viruses get their name from their ability to spread from one infected host to

another, normally on the same network. They are designed like biological viruses to be as

transmissible as possible. Like many biological viruses, the most dangerous among them

are the ones that lay dormant and replicate before causing noticeable damage. Computer

viruses are designed to either cause damage or steal information. Many years ago, viruses

were often used to cause damage for no apparent purpose. Modern viruses are designed

to steal data or destroy systems. Different threat actor groups are likely to use different

types of malicious software to accomplish their goals. Hacktivists and governments may

use viruses to destroy systems. Criminal groups are more likely to use viruses that steal

data so they can sell it for a profit or ransomware so they can extort victims directly. A key

characteristic of a virus is that it needs activation from a host. As a result, a virus must be

paired with a social engineering technique to be effective. While often conflated, worms

are different from viruses.

*Worms-

Worms are like viruses in their aims but are far more sophisticated. A worm can replicate

itself and infect other systems on a network without a user doing anything. Worms only

need to breach one system on a network and can compromise all other connected systems.

Worms can be extremely powerful and are often used by nation-state actors. One of the

most famous worms, Stuxnet, was used to disrupt Iran's nuclear program. You can read

more about Stuxnet in an example case in Chapter 3, Anatomy of an Attack, detailing the

operation. While worms are often more sophisticated and damaging than viruses, there

are successful worms available for sale on the dark web. As a result, an unsophisticated

attacker with resources can launch this advanced capability against unsuspecting victims.

While worms and viruses often seek to exploit systems as soon as they can do so, trojans

are a type of malicious software that are designed to remain undetected.

*Trojans-

Trojans get their name from the story of the trojan horse. A trojan is a piece of malicious

software masquerading as a legitimate piece of software. To work properly, a trojan

must have two sides. One side is the legitimate software that must function properly

for someone to keep it installed. The other side is the malicious side, which allows the

attacker some level of access to the machine. An example would be a game that a user

could download and install. They would be able to play the game and it would work, but

the software would also be providing remote access to an attacker. This type of trojan is

commonly called a Remote Access Trojan (RAT).

Other types of trojans lay dormant until activated by an attacker. An example would be a

Distributed Denial of Service (DDoS) attack. A DDoS attack occurs when an attacker

coordinates many machines that flood a target system with a large volume of illegitimate

requests, so it does not have the capacity to service legitimate requests. To successfully

launch such an attack, a bad actor must be able to access a large number of machines on

command. Trojans offer the ability for attackers to create these types of networks, often

referred to as a botnet. Some attackers will use trojans to build a botnet and then sell or

lease the network to other bad actors to monetize their attacks. Botnets can be used for

many types of attacks, such as credential-stuffing attacks, in addition to DDoS attacks.

Next, let's talk about a malicious software type that often makes headlines, ransomware.

*Ransomware-

Ransomware can be delivered as a virus or a worm, but it has become popular enough that

it warrants its own section. Ransomware is designed to hold files or systems for ransom

to demand payment from a victim. Often, it works by encrypting as many files as possible

and demanding ransom in exchange for the decryption key. If the ransom is not met

within a specific period, the files will be destroyed.

Ransomware has become popular largely because it is profitable and people are paying

the ransom. Ransomware groups have even dedicated resources to providing technical

support and ensuring that when victims pay the ransom, their files are restored. If

the victim believes they are doomed regardless, they are less likely to pay. As a result,

ransomware groups guard their reputation carefully. Unlike ransomware, spyware is

installed to collect information rather than to extort the victim.

*Spyware-

Spyware is designed to steal information and monitor activity rather than cause harm to a

system or explicitly steal data. An example is a keylogger. A keylogger creates a record of

everything you type on a keyboard for the purposes of finding information that could be

valuable to an attacker, such as a password or credit card number.

Spyware can also be used for industrial and state-sponsored espionage. Spyware is often

covert and designed to use as few resources as possible to remain undetected for as long as

possible. Think of spyware as the computer equivalent of a bug or listening devices from

decades past.

Now that we understand malicious software types, we will discuss the types of insider

threats. We will start with the largest population, well-meaning insiders.

*The three types of insider threats

Inside an organization, there are three basic human profiles. First, well-meaning insiders

are people trusted by the organization to perform a function and are attempting to

do so. Either for the sake of expediency or by error, those people can often expose the

organization to unnecessary risk. Second, trusted insiders can become compromised

through social engineering tactics, such as phishing, and someone outside the

organization may be masquerading as them. These compromised accounts can lead to

major data breaches and damage. Third, there are malicious insiders. These people are

trusted and likely started as well-meaning insiders, but at some point became malicious.

In some cases, the employees are bribed by outside actors. In other cases, they are

frustrated by real or perceived slights by the organization. Regardless, their knowledge of

the environment and privileges makes them very dangerous.

First, we will discuss well-meaning insiders.

*Well-meaning insiders

Most users in an organization are simply trying to do their jobs within the confines of

acceptable behavior. Supporting well-meaning insiders is an important function of any

effective information security program. The first way that well-meaning insiders expose

data or systems is by making simple mistakes.

*Mistakes leading to exposure

The first category of risk attributable to well-meaning insiders is a simple mistake.

One common mistake is sending the right information to the wrong person. For example,

you may have a John.Smith@abccompany.com and a John.Smith@xyzcompany.

com in your email address book. Since they have the same exact name until you get to

the company name, a person may mistakenly attach ABC company's information to

XYZ company's email. Doing so would be considered a data breach, but one that was

purely accidental. Another common mistake is sending an Excel spreadsheet where the

sensitive data is hidden but not entirely removed, so if the recipient or someone who

intercepted the message unhid the rows or tabs, they would be able to access

information inappropriately. Tools such as Data Loss Prevention (DLP) and secure email

gateways offer capabilities that help prevent these types of mistakes from causing harm to

the organization.

Outside simple mistakes, many large-scale data breaches happen because of

misconfigurations. In many cases, the person configuring the systems has not been

properly trained.

*Challenges with new technologies

Another common mistake people make is misconfigurations due to gaps in knowledge

around solutions they are managing. In many cases, the adoption of new technologies

happens faster than an organization's ability to retrain its staff on these new technologies.

In many cases, cloud configurations feel familiar to network administrators but have

significant differences, as noted in the following example case related to Alteryx. Issues

related to the shared security model are important for cloud administrators to understand.

With the skills gap in security, it is important to offer training opportunities for existing

team members as technologies change. Unfortunately, many professionals are put into

situations where they are asked to perform high-risk functions without the proper

training and support.

*Case: Alteryx

Alteryx is a technology company that builds software to power data science

and analytics. Because of the nature of their business, Alteryx has information

belonging to most American households. Collection of personal information for

the purpose of analytics is one of the practices that the General Data Protection

Regulation (GDPR) in the European Union and the California Consumer

Privacy Act (CCPA) seek to regulate. The massive Alteryx data breach is one of

the major reasons why regulations such as GDPR and CCPA exist.

Alteryx accidentally exposed information that belonged to 123 million of the

estimated 126 million households in America. If you live in America, there is a

97.6% chance that Alteryx made your sensitive information publicly available, but

most Americans do not know who Alteryx is or did not provide the information

directly to Alteryx. How did Alteryx gather the information before the breach?

They purchased it from Experian so they could analyze the information. Most

people also did not voluntarily give their information to Experian. Credit

monitoring agencies have historically had the ability to collect information

about individuals without their consent and then sell it to third parties without

notification. When organizations collected and curated information about people

in the past, it was common practice for them to resell that information to other

parties who may wish to use it, often without the knowledge of the data subject.

Cases such as Alteryx have made it popular to allow consumers to make their

own choices with respect to who has their information.

The information involved in the Alteryx breach was stored in a popular cloud

platform, Amazon Web Services (AWS). AWS is an Infrastructure as a Service

(IaaS) platform where companies can rent space and processing power. For

analytics companies such as Alteryx, renting high-powered computers or server

farms on-demand is simpler and more cost effective than building large data

centers filled with powerful servers sitting idle most of the time. The problem is,

security controls for AWS are different than on-premises systems, and the people

who work with AWS must be trained to secure the environment properly. The

good thing about the cloud is the data is accessible from anywhere. The bad thing

about the cloud is the data is accessible from anywhere. As a result, if it is not

secured properly with techniques such as access control, it can be accessible to

anyone. That is exactly what happened in the case of Alteryx.

Fortunately, Alteryx's mistake was discovered by a security researcher, not a

criminal (that we know of), and quickly corrected. In fact, "Chris Vickery, the

director of cyber risk research at cybersecurity start-up UpGuard, discovered the

data Oct. 6 on Amazon Web Services, or AWS" (Lien, 2017). Mr. Vickery and

UpGuard should be applauded for finding this vulnerability and making Alteryx

aware of it. However, it is difficult to know for sure if anyone else accessed the

information before the vulnerability was reported to Alteryx. Technology is

changing quickly. It is critical to ensure employees are trained properly when

working with new technologies and safeguards are put in place to ensure an

individual mistake cannot cause a large-scale data breach.


Saturday, October 22, 2022

DNS Records

 A -Address Mapping Record

      The record A specifics IP Address           

      (IPv4)for given host.

      


AAAA -IP Version 6 Address Record

              The record AAAA (also qued-A               

              record) specifics,IPv6 address for 

              given host.

              

 

CNAME -Canonical Name Record

                 The CNAME record specifics a 

                 domain name that has to be 

                 queried in order to resolve the

                 original DNS query.

                 


NS -Name Server Record

         The NS record specifics an authorised 

         name server for given host.

         


PTR -Reverse Look-up Pointer Record

          As oppord to forward DNS revolution

          (A and AAAA DNS record)      

          

MX -Mail Exchange Record

          The MX resources record specifics a

          mial exchange server for a DNS 

          domain name.


SOA -Start of Authority Record

           The record specific core information

Basic Linux Commands

help -Shows you basics Commands and their use.


man -Shows you complete manual of that command or program.

ex- man ls , man cd , etc.


info -Shows the information of Commands.


ls - List all'the folder or files of a directory.


cd - Change directory (one' folder to another).


q -This command used to (exit the folder or files.)


h -Used to see a file or folder in mb/kb.


pwd - Print working directory.


dir -Same as ls.


mkdir -Creates an directory (folder).


cp - Copy a file or folder.


mv -Move a file or folder.


sudo su -Grant root privileges.

nano shell program.


cat -Shows content of a file.


rm -Remove a file.


rmdir -Remove a folder.


nano -Linux file editor.


ctrl+x -Used to exit the file or folder.


getit -File editor software.


chmod -Change directory permission.


./ -Executes shell files.


bash -Executes shell program.


apt-get-update -Update package lists (URL).


apt-get-upgrade -Update all installed software's.


apt-get-install -Install particular software.


whoami , y -For fun 


#aivel 





"Who is the Hacker"

 *Using his/her skills and knowledge to gain unauthorised access to a software computer or network.

*Use her/his own tools and techniques.

*Is NOR always bad.

*Can go to prison or earn millions.

#aivel

All Linux Commands

 *MOST USED ls -List files in directory ls -a List all files, including hidden ones pwd -Show the directory currently working in mkdir- ...