Showing posts with label terminal. Show all posts
Showing posts with label terminal. Show all posts

Sunday, September 11, 2016

Kali Linux : Touchpad issues - tapping, reverse/natural scrolling

Since I've started using Kali Linux, I have often encountered problems with my touchpad. The problem can either be with tapping (tapping the touchpad doesn't result in a click, and I have to press the physical button), or with scrolling (two finger scrolling doesn't work).

I have come across the following 3 fixes. At least one of them should work for you-

Fix 1: Easiest - GUI setting

This fix requires no fancy commands. You just have to go to Mouse & Touchpad settings and make appropriate changes. To go to the settings, you can either-
  • Press the windows key (on the lower bottom, Ctrl key, Function key, Windows key, Alt key), and type mouse in the search bar that shows up.
  • Click the activities button on the top left, and type mouse in the search bar that shows up.


Now, you should see something like this-


You can check the tap to click and two finger scroll options and your problem is solved.

If, however, you see something like this-

Then you have to use the next fixes, as the Mouse and Touchpad setting are useless for you.

Fix 2 : Tapping and reverse Scroll

If you are able to scroll just fine, but your touchpad is not registering the taps, then just type this command into the terminal-
synclient tapbutton1=1
This should enable tapping for you.

In my case, I had scrolling working without any problems, but I prefer natural scrolling, and that option wasn't there for me in mouse & touchpad settings. However, if you type synclient into the terminal, you see something like this-

new@kali:
    Parameter settings:
        LeftEdge                = 1618
        RightEdge               = 5366
        TopEdge                 = 1356
        BottomEdge              = 4536
        FingerLow               = 25
        FingerHigh              = 30
        MaxTapTime              = 180
        MaxTapMove              = 251
        MaxDoubleTapTime        = 100
        SingleTapTimeout        = 180
        ClickTime               = 100
        EmulateMidButtonTime    = 75
        EmulateTwoFingerMinZ    = 282
        EmulateTwoFingerMinW    = 7
        VertScrollDelta         = 114
        HorizScrollDelta        = 114
        VertEdgeScroll          = 0
        HorizEdgeScroll         = 0
        CornerCoasting          = 0
        VertTwoFingerScroll     = 1
        HorizTwoFingerScroll    = 0
        MinSpeed                = 1
        MaxSpeed                = 1.75
        AccelFactor             = 0.035014
        TouchpadOff             = 0
        LockedDrags             = 0
        LockedDragTimeout       = 5000
        RTCornerButton          = 0
        RBCornerButton          = 0
        LTCornerButton          = 0
        LBCornerButton          = 0
        TapButton1              = 1
        TapButton2              = 0
        TapButton3              = 0
        ClickFinger1            = 1
        ClickFinger2            = 1
        ClickFinger3            = 1
        CircularScrolling       = 0
        CircScrollDelta         = 0.1
        CircScrollTrigger       = 0
        CircularPad             = 0
        PalmDetect              = 0
        PalmMinWidth            = 10
        PalmMinZ                = 200
        CoastingSpeed           = 20
        CoastingFriction        = 50
        PressureMotionMinZ      = 30
        PressureMotionMaxZ      = 160
        PressureMotionMinFactor = 1
        PressureMotionMaxFactor = 1
        GrabEventDevice         = 0
        TapAndDragGesture       = 1
        AreaLeftEdge            = 0
        AreaRightEdge           = 0
        AreaTopEdge             = 0
        AreaBottomEdge          = 0
        HorizHysteresis         = 28
        VertHysteresis          = 28
        ClickPad                = 0

You can quickly notice the VertScrollDelta (delta usually refers to rate of change, here speed of scrolling) parameter which for me is set to 114. I decided to check if making it -114 would make it scroll at the same speed but in the opposite direction. To test that, I tried the following command-
synclient VertScrollDelta=-114
And turns out I was right and it did reverse the direction of scrolling.

Little problem

These changes that we made aren't persistent, and the synclient setting would revert to default every time you start your system again. There are many solutions to this, one of which include editing files in /usr/share/X11/xorg.conf.d/. However, these files tend to get overwritten and we have to deal with a lot of other mess to fix that behavior.

Instead, we will use a very simple solution, and just run the above two commands on system startup.

Add the commands to startup

Step 1 : Navigate to the .config directory
cd ~/.config/
Step 2 : Check if autostart folder exists
ls
Step 3: If it doesn't exist, create the folder. If it exists, skip this step
mkdir autostart
Step 4: Navigate to autostart folder
cd autostart
Step 5: Use your favorite text editor [vim v/s/ sublime text?] (or cat ). I'm using leafpad to make things look less intimidating.
leafpad script.desktop
Step 6: A leafpad windows will pop up. Paste one of the following into the window and then save and then close leafpad.
If you are logged in as root (probably the case)
[Desktop Entry]
Name=MyScript
Type=Application
Exec=/root/script.sh

If you are logged in as another user (if you created a non-superuser account)
[Desktop Entry]
Name=MyScript
Type=Application
Exec=/home/<name here>/script.sh

Note 1 : To find the <name here> in second case, just navigate to home (cd ~) and find present working directory (pwd)
Note 2 : (If you're curious why I didn't use ~ and instead made two different scripts for root and other users) Exec=~/script.sh didn't work for me. Maybe it does work in general, and there was some other factor in play for me, or maybe it isn't supposed to work at all. Not sure. Any comments in this regard are welcome.

Step 7: Change directory to home.
cd ~
Step 8: Create a file called  script.sh
leafpad script.sh
Step 9: Paste the following code into it. Then save.

synclient tapbutton1=1 #To enable tapping
synclient VertScrollDelta=-114 #To reverse direction of scroll
PS: Paste only the lines required by you.

Step 10: Make it executable
chmod 777 script.sh
or
chmod a+x script.sh
Restart Kali and see if your tapping and reverse scroll are still working. If not, go through the steps again and see what you missed. Everything is case sensitive so you have to be very careful in that regard.

TroubleShooting

If typing the commands into the terminal worked for you, but automation by adding the commands to startup didn't, then here is one simple troubleshooting tip to isolate the problem.

Open a terminal and type
./script.sh
If your tapping/reverse scrolling is working fine now, then your script is fine, but the autostart directory content is not. Recheck steps 1 to 6.
If your tapping/reverse scrolling isn't working fine, then your script is flawed. Recheck step 7 to 10.

Fix 3 : modprobe method

I found out about this method here. It did fix a few things for me, but like the second reply on the thread, what happened with me was- 

Earlier my scroll was working and tap to click wasn't
After running the commands
Tap to click started working and two finger scroll stopped working

Also, even when my scroll was working it wasn't natural scroll and that's a bit inconvenient for me. So, Fix 2 above was the best fix for me. However, I've included this fix because it seems to work with most people. So here it is- 

Step 1 : Open a terminal. 
Step 2 : Type the following command. Your mouse pointer will stop working after typing the first command and will resume continue working (hopefully with the touchpad problems solved) after the second.
modprobe -r psmouse 
modprobe psmouse proto=imps

Persistence

Follow these steps-

Step 1 : Navigate to required directory
cd /etc/modprobe.d/
Step 2 : Open text editor
leafpad whatever.conf
Step 3:  Paste this-
options psmouse proto=imps

Step 4: Save and exit

Restart and see if the changes are persistent. 

Again, I reiterate, this method is based on a fix I found on Kali Forums, and you should read further there if you are facing any problems.

That said, if you are facing any problems, then feel free to comment. If you followed the guide but had to do something a bit different to get it working, then also comment, as it may help others.

Wednesday, January 27, 2016

Hack Any Android Phone : msfvenon - Metasploit payload generator

msfvenom is a kali linux hacking tool for android ,is a combination of Msfpayload and Msfencode, putting both of these tools into a single Framework instance known as msfvenom payload.

Hacking With METASPLOIT in Kali Linux is a old tool. Metasploit is enhanced by msfvenom in kali linux. Metasploit is now a outdated tool.


So, let's get started!!



Wednesday, July 16, 2014

Tutorial on Hacking With Kali Linux

Hacking With Kali Linux


Why Kali Linux?

With Kali Linux, hacking becomes much easier since you have all the tools (more than 300 pre-installed tools) you are probably ever gonna need. Others can be downloaded easily. Now this tutorial will get you started and you'll be hacking with Kali Linux before you know it.







The problem with beginners

Now, I've been dealing with beginners since a long time (and myself was one for a long time too). What they want is magic. A tool which is easy to use, works on Windows, can be download by searching on Google and clicking on the first link we see, and will do all the hacking itself on the push of a button. Sadly, no such tool exists (lets be real, would you use Facebook if a tool existed which you could install on Windows, simply type the person's username/mobile number/email and then just like that get his/her Facebook password?). 

Hacking is an art, and it takes years of practice to master it. So how to get started? Having no idea about hacking is okay, but being a newbie with computers in general is not allowed. When I say beginner, I mean someone who has no experience with programming and with hacking methodologies. I didn't mean someone who needs a 1 page guide on how to download a tool. If you want to be a hacker, you have to work hard. So how to get started? If you have installed Kali Linux,  click here to skip past the installation paragraphs and go to hacking section of this post)



Getting Started

Now, I am not boring you with theory (^ As if all this wasn't enough theory). My aim is to get you to the point where you can start hacking with Kali Linux as soon as possible. What I'm gonna do is tell you what to do. The process is rather simple :-




Things get tough now

If you have no previous experience with Linux and virtual machines and all that stuff, getting Kali Linux up and running won't be a piece of cake.You have 2 options 3 options :


1. Read the Kali official documentation

That will give you an idea about what is a virtual machine, how OS can be run from USB, and how to create a partition and run 2 OS simultaneously. This is what I recommend. For that, go to Kali Official Documentation .

2. Read my modified version of Kali documentation

The second option is to look at these posts, which are just sparingly modified (and now outdated) versions of the Kali docs, and offer no advantage other than saving your time as their documentations cover much more than what the ones here do, and you don't really need to know all so much... yet. I'm linking them up here:

3. Utilize the zillions of tutorials on YouTube (New option)

The time this guide was written (for the first time in 2013, then updated in 2014), Kali wasn't so popular. However, now there are plenty of websites dedicated to Kali Linux, and a lot of YouTube videos on how to install Kali. My installation guides are outdated (mine are for Kali 1.0, now even Kali 2.0 is outdated and Kali rolling is what most of you should be using). While you can use an old installation guide and make a few changes and have it work for you, it's better, especially if it's your first time installing an operating system alongside another, that you follow a guide tailored for your situation (eg. if you are installing Kali rolling on Windows 10 on virtualbox, then follow guide for the exact same configuration, and not for Kali 2.0 on Windows 8 on Vmware).
Installing an OS is serious business, don't take it lightly, and don't get discouraged if you fail at first. Also, backup your data if you're going for a dual boot.


Command Line Interface

Some bash commands
Now, if you are really sure about becoming a hacker, you have to get used to linux, and specifically the command line interface. It is often compared to (and rightly so) to command prompt of Windows, but Linux' cli is much efficient and better than command prompt. What you have to do is do all the usual tasks you do in Windows in cli of Linux. Use cd to navigate, poweroff to shutdown, etc.
A pretty awesome site for that is - http://linuxcommand.org/
Going through the complete site is on its own enough exercise to keep you occupied for a month, but you can proceed gradually. The first few tutorials here will keep in mind that you don't have much info about cli, and will be really beginner friendly.



    Some Useful Commands:

    If you don't plan on learning all of linux cli commands, here are a few that will keep your boat afloat.
    1. The default username and password is 'root' and 'toor'. 
    2. Type 'poweroff' in the terminal to shutdown. 
    3. apt-get command can be used to install tools and updates. 
    4. apt-get update and apt-get upgrade will update all the programs installed on your machine. 
    5. apt-get dist-upgrade will install the latest distribution of Kali(i.e. it upgrades your OS).

    PS : Tapping <tab> while typing makes Kali complete the word for you . Double tapping <tab> makes it display all possible words starting with the incomplete word. Ctrl+c stops the functioning of any tool that is running. Pressing the up arrow key shows the command you last typed.


    Some Real Hacking With Kali Linux

    Assuming you've gone through the above steps and are comfortable with your new hacking environment, its time to do some real hacking with Kali Linux. My recommendation would be to start by hacking a wifi, then do some penetration testing, and maybe read something on Denial of Service when you have free time. Links here-

    Hack wireless networks in Kali Linux using aircrack

    Penetration Testing In Kali For Beginners

    Denial Of Service Attacks

    Thursday, June 5, 2014

    Remotely Access Kali Terminal Using Putty

    In this post we will use PuTTy to remotely or locally access Kali terminal with root priveleges. We will use SSH for this tutorial, though you can use Telnet or any other mode too.

    Putty

    Some theoretical inforamtion about putty for your digestion.
    PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform. PuTTY is open source software that is available with source code and is developed and supported by a group of volunteers. (putty.org)

    Monday, August 5, 2013

    Wifi Hacking - WEP - Kali Linux Aircrack-ng suite

    Alright, this post is written assuming you have Kali Linux up and running on your computer. If not, here is a post on hacking with kali linux. It will tell you about what Kali Linux is, and how to use it. It will guide you through installation process.
    So if you are still following, then just follow these simple steps-

    Firstly, create a wireless network to crack. Don't use this method on others. It is illegal. Then proceed with the steps below.


    1. Find out the name of your wireless adapter.

    Alright, now, your computer has many network adapters, so to scan one, you need to know its name. So there are basically the following things that you need to know-
    • lo - loopback. Not important currently.
    • eth - ethernet
    • wlan - This is what we want. Note the suffix associated.
    Now, to see all the adapters, type ifconfig on a terminal. See the result. Note down the wlan(0/1/2) adapter.




    2. Enable Monitor mode

    Now, we use a tool called airmon-ng to  create a virtual interface called mon. Just type 
    airmon-ng start wlan0
     Your monitoring interface will be created - mon0 in case of Kali 1.x, wlan0mon in all other cases. 



    3. Start capturing packets

    Now, we'll use airodump-ng to capture the packets in the air. This tool gathers data from the wireless packets in the air. You'll see the name of the wifi you want to hack. For kali 2.0 or rolling, replace mon0 with wlan0mon
    airodump-ng mon0


    4. Store the captured packets in a file 

    This can be achieved by giving some more parameters with the airodump command. For Kali 2.0 or rolling, replace mon0 with wlan0mon.
    airodump-ng mon0 --write name_of_file

    Now the captured packets will be stored in name_of_file.cap

    You will have to wait till you have enough data (10000 minimum)
    PS: Don't wait too long for this step though. Just understand how the procedure works (including the next sections), and once you are convinced you know what you are doing, proceed to the next tutorial where we use ARP replay to speed up the rate at which we gets packets. Using ARP request replay, we can get 10k packets in a few minutes.



    5. Crack the wifi

    If all goes well ,then you'll be sitting in front of your pc, grinning, finally you've got 10000 packets (don't stop the packet capture yet). Now, you can use aircrack-ng to crack the password. (in a new terminal)
    aircrack-ng name_of_file-01.cap 
    The program will ask which wifi to crack, if there are multiple available. Choose the wifi. It'll do its job. If the password is weak enough, then you'll get it in front of you. If not, the program will tell you to get more packets. The program will retry again when there are 15000 packets, and so on.

    You'll get the key, probably in this format-
    xx:xx:xx:xx:xx
    Remove the colons
    xxxxxxxxxx is the password of the wireless network

    Issues?

    Try this-
    ifconfig wlan0 up
    ifconfig wlan0 down
    airmon-ng check kill
    rfkill unblock all
    Or this- (from Sebastian's comment below)

    With the new version, the monitor is wlan0mon, and the monitor isn't working.
    A solution is the commands:
    ifconfig wlan0mon down
    iwconfig wlan0mon mode monitor
    ifconfig wlan0mon up

    Source: http://stackoverflow.com/questions/32025472/airodump-ng-wlan0mon-doesnt-work

    Disconnected from internet (wifi)?

    Again, replace mon0 with wlan0mon for Kali 2.0 or rolling.
    airmon-ng stop mon0
    This is usually sufficient. If wlan0 is not up (check ifconfig or iwconfig), then do this (if you don't know what to do, then do this anyway)-
    ifconfig wlan0 up
     If wifi still doesn't start, try this too
    service network-manager restart

    Want to try an easier method?

    Use wifite, just one command required

    For WPA/WPA-2

    Hacking wpa/wpa-2 wps with reaver on kali linux

    For Troubleshooting

    The missing ingredient

    This attack taking too long? Ready to go further?

    Speed up WEP hacking with ARP replay attack

    WPA hacking sucks? There's an alternate way to go about it

    Hacking WPA/WPA-2 without dictionary/bruteforce : Fluxion

    © Kali Tutorials, 2016. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Shashwat Chaudhary and Kali Tutorials with appropriate and specific direction to the original content.