Enable WIFI ADAPTER Monitor Mode in Kali Linux

Connect the WIFI adapter and add it in VirtualBox USB Settings TP-Link TL-WN725N 150Mbps Wireless N Nano USB Adapter https://www.amazon.in/gp/product/B008IFXQFU Check the Adapter Chippet lsusb Bus 001 Device 002 : ID 2357 : 0109 TP-Link TL-WN823N v2 / v3 [Realtek RTL8192EU] Bus 001 Device 001 : ID 1 d6b: 0002 Linux Foundation 2 . 0 root hub Bus 002 Device 002 : ID 80 ee: 0021 VirtualBox USB Tablet Bus 002 Device 001 : ID 1 d6b: 0001 Linux Foundation 1 . 1 root hub Find Appropriate Driver for Realtek RTL8192EU from GitHub https://github.com/clnhub/rtl8192eu-linux Install the dependencies sudo apt install linux-headers-generic build-essential dkms git Clone the Driver git clone https://github.com/clnhub/rtl8192eu-linux.git Configure the Architecture and Monitor Mode Open MakeFile in Text Editor or Nano If you're using a different architecture than x86, the set (MakeFile) CONFIG_PLATFORM_I386_PC = n set your architecture CONFIG_PLATFORM_ARM_AARCH64

Resolved: Connecting MongoDB URI with Password having Special Characters

  • MongoDB provides drivers for connecting databases with various programming languages like Java, Python, JavaScript, and C#. As per official documentation, there is a standard URI (Uniform Resource Identifier) for creating connection through programming. The syntax is,

mongodb://username:password@host:port/defaultauthdb
  • If the password has special characters like : / ? # [ ] @ then there will be a problem with the above URL syntax for making connection. To resolve this, Percentage-encoding mechanism can be used in URI,

  • A percent-encoded octet is encoded as a character triplet, consisting of the percent character "%" followed by the two hexadecimal digits representing that octet's numeric value - Wikipedia.
  • Percentage-encoding for / ? # [ ] @
    / - %2F
    ? - %3F
    # - %23
    [ - %5B
    ] - %5D
    @ - %40
    
  • Sample Passwords

  • Secure@pass567 can be written as Secure%40pass567
    • URI: mongodb://tom:Secure%40pass567@localhost:27017/demodbname
  • Secre#tig] can be written as Secre%23tig%5D
    • URI: mongodb://jerry:Secre%23tig%5D@localhost:27017/demodbname

Sample Java Snippet for Connecting MongoDB

import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import static com.mongodb.client.model.Filters.eq;

/**
 * MongoDB Connection Test using Java
 * @author Anthoniraj Amalanathan
 * @since 17-May-2022
 */

public class MongoTest {
    public static void main(String[] args) {
        /* Password has special char @ hence percentage encoding %40 used. */

        String uri = "mongodb://tom:Secure%40pass567@localhost:27017/demodbname";
        try (MongoClient mongoClient = MongoClients.create(uri)) {
            MongoDatabase database = mongoClient.getDatabase("demodbname");
            MongoCollection<Document> collection = database.getCollection("employee");
            Document doc = collection.find(eq("_id", "100")).first();
            System.out.println(doc.toJson());
          }
    }
}

Comments

Popular posts from this blog

How to add or remove plugins to Redmine Project Management Software?

Setting up the Java, JavaFX, and Servlet Environment

Setup SSH Server in Ubuntu or Virtualbox Guest OS