Showing posts with label kali. Show all posts
Showing posts with label kali. Show all posts

Monday, April 15, 2024

Selenium on nethunter (pixel)

Make sure firefox is installed

$ firefox -V
Mozilla Firefox 115.5.0esr

Download geckodriver

$ wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux-aarch64.tar.gz
$ tar xzvf geckodriver-v0.34.0-linux-aarch64.tar.gz

After this step "geckodriver" should be there

$ ./geckodriver -V
geckodriver 0.34.0 (c44f0d09630a 2024-01-02 15:36 +0000)
The source code of this program is available from testing/geckodriver in https://hg.mozilla.org/mozilla-central.
This program is subject to the terms of the Mozilla Public License 2.0. You can obtain a copy of the license
at https://mozilla.org/MPL/2.0/

Install 'selenium'

$ pip3 install selenium

Test code

import os
import sys
import logging
from selenium import webdriver
from selenium.webdriver.firefox.service import Service


THIS_DIR = os.path.dirname(os.path.abspath(__file__))
DRIVER = os.path.join(THIS_DIR, "geckodriver-v0.34.0-linux-aarch64", "geckodriver")

if not os.path.exists(DRIVER):
    print("Cannot find 'geckodriver'")
    sys.exit(1)


def main():
    print("Downloading web page...")

    s = Service(executable_path=DRIVER)

    options = webdriver.FirefoxOptions()
    options.add_argument("--headless")

    driver = webdriver.Firefox(service=s, options=options)
    
    driver.get("https://www.google.com")
    driver.save_screenshot("screenshot.png")

    print("Please check screenshot image")
    driver.quit()


if __name__ == '__main__':
    main()

After run this code "screenshot.png" should be generated

To show "screenshot.png" image in RLogin

$ sudo apt install libsixel-bin
$ img2sixel screenshot.png

Done.

Monday, May 15, 2023

Wireshark does not work with Tightvncserver

Using kali linux on raspberry pi 4 but wireshark does not work with tightvnc server...  According to this issue report, it's the issue with Qt 

Version of Kali linux I'm using:

$ cat /etc/os-release                       

PRETTY_NAME="Kali GNU/Linux Rolling"

NAME="Kali GNU/Linux"

VERSION="2023.1"

VERSION_ID="2023.1"

VERSION_CODENAME="kali-rolling"

ID=kali

ID_LIKE=debian

HOME_URL="https://www.kali.org/"

SUPPORT_URL="https://forums.kali.org/"

BUG_REPORT_URL="https://bugs.kali.org/"

ANSI_COLOR="1;31"

To fix this issue, changing from "tightvnc" to "tigervnc-standalone-server" and confirmed that the issue is actually fixed

Steps to install and my config:

1. Fist install "tigervnc-standalone-server"
$ sudo apt install tighervnc-standalone-server
After this step, "update-alternatives" will change the link of "vncserver" from "/usr/bin/tightvncserver" to "/usr/bin/tigervncserver"

2. Generate password
$ vncpasswd

3. Then create "/etc/systemd/system/vnc-server.service" file as below:
$ cat /etc/systemd/system/vnc-server.service
[Unit]
Description=VNC Server

[Service]
ExecStart = sudo -u kali vncserver -geometry 1440x900 :1 -localhost=0
ExecStop = sudo -u kali vncserver -kill :1
Type = forking

[Install]
WantedBy = multi-user.target

After this just enable/start the service...

Note: "-localhost=0" option is intentionally used in my environment (not secured) because I just want to directly connect to the VNC service, without using a SSH tunnel. By default this option of "tigervncserver" is "-localhost=1"