Minggu, 26 Desember 2021

Vt-x/ept is not supported on this platform

  1. nonaktifkan Hiper V pada windows agar Aplikasi VM dapat berjalan
  2. buka Command Prompt pada windows dan jalankan sebagai Run as administrator
  3. ketikan perintah C:\bcdedit /set hypervisorlaunchtype off 
  4. restart komputer, dan jalankan ulang VM


Selasa, 09 November 2021

Melihat jumlah keping RAM pada server Linux (Ubuntu,Centos)

Untuk Melihat jumlah RAM yang terinstall pada OS Linux (Ubuntu,Centos), kita dapat menggunakan command “dmidecode” untuk menampilkan informasinya.

[root@foo ~]# dmidecode --type=17
# dmidecode 2.10
SMBIOS 2.6 present.
Handle 0x002E, DMI type 17, 28 bytes
Memory Device
Array Handle: 0x002C
Error Information Handle: Not Provided
Total Width: 72 bits
...............more

Jika kita ingin melihat besar RAM perkepingnya kita bisa menggunakan command “dmidecode –type-17 | grep Size”

[root@foo ~]# dmidecode --type=17 | grep Size
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: 16384 MB
Size: No Module Installed
Size: No Module Installed
Size: 16384 MB
Size: 16384 MB

Dari hasil diatas terlihat ada 2 keping RAM yang tidak terbaca kapasitasnya, ada kemungkinan keping RAM tersebut rusak atau memang tidak terinstall RAM. untuk mengetahui slot RAM di Linux(Ubuntu,Centos) yang rusak atau tidak terinstall RAM kita dapat menggunakan perintah “dmidecode –type=17 | grep Locator”

[root@foo ~]# dmidecode --type=17 | grep Locator
Locator: P1_DIMM1A
Bank Locator: BANK0
Locator: P1_DIMM1B
Bank Locator: BANK1
Locator: P1_DIMM2
Bank Locator: BANK2
Locator: P1_DIMM3
Bank Locator: BANK3
Locator: P2_DIMM1A
Bank Locator: BANK4
Locator: P2_DIMM1B
Bank Locator: BANK5
Locator: P2_DIMM2
Bank Locator: BANK6
Locator: P2_DIMM3
Bank Locator: BANK7

Dari hasil tersebut maka terlihat RAM yang rusak di Linux(Ubuntu,Centos) ada di slot P2_DIMM1A & P2_DIMM1B.
Selain “dmidecode” kita juga bisa menggunakan perintah “cat /proc/meminfo”

[root@foo ~]#cat /proc/meminfo
MemTotal: 2069956 kB
MemFree: 60652 kB
Buffers: 16032 kB
Cached: 1831416 kB
SwapCached: 32 kB
Active: 172144 kB
Inactive: 1791604 kB
HighTotal: 1174144 kB
HighFree: 4008 kB
.........more

Untuk melihat Maximal Total RAM

[root@foo ~]# dmidecode -t 16
# dmidecode 2.9
SMBIOS 2.6 present.

Handle 0x000E, DMI type 16, 15 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: None
        Maximum Capacity: 4 GB
        Error Information Handle: Not Provided
        Number Of Devices: 2

Untuk melihat SN dan PID server

[root@foo ~]# dmidecode --type system

atau

[root@foo ~]# dmidecode -t system

# dmidecode 2.9
SMBIOS 2.6 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: Compaq-Presario
        Product Name: BK134AA-AR6 CQ4168L
        Version:
        Serial Number: CNX00405RF
        UUID: 10BAD777-280A-DF11-9D30-6D18AEF462FD
        Wake-up Type: Power Switch
        SKU Number: BK134AA#AR6
        Family: 103C_53316J

Handle 0x0012, DMI type 32, 20 bytes
System Boot Information
        Status: No errors detected

Untuk melihat SN dan PID(Part Number) RAM

[root@foo ~]# dmidecode --type memory

Memory Device
    Locator: DIMM_A1
    Bank Locator: BANK 0
    Manufacturer: Kingston
    Serial Number: 12345678
    Asset Tag: 987654321
    Part Number: KHX3200C16/8G 
 

dmidecode list code

        Type       Information
        ----------------------------------------
          0        BIOS
          1        System
          2        Base Board
          3        Chassis
          4        Processor
          5        Memory Controller
          6        Memory Module
          7        Cache
          8        Port Connector
          9        System Slots
         10        On Board Devices
         11        OEM Strings
         12        System Configuration Options
         13        BIOS Language
         14        Group Associations
         15        System Event Log
         16        Physical Memory Array
         17        Memory Device
         18        32-bit Memory Error
         19        Memory Array Mapped Address
         20        Memory Device Mapped Address
         21        Built-in Pointing Device
         22        Portable Battery
         23        System Reset
         24        Hardware Security
         25        System Power Controls
         26        Voltage Probe
         27        Cooling Device
         28        Temperature Probe
         29        Electrical Current Probe
         30        Out-of-band Remote Access
         31        Boot Integrity Services
         32        System Boot
         33        64-bit Memory Error
         34        Management Device
         35        Management Device Component
         36        Management Device Threshold Data
         37        Memory Channel
         38        IPMI Device
         39        Power Supply


       Keyword     Types
       ------------------------------
       bios        0, 13
       system      1, 12, 15, 23, 32
       baseboard   2, 10
       chassis     3
       processor   4
       memory      5, 6, 16, 17
       cache       7
       connector   8
       slot    

sumber :

https://blog.radhioflyer.web.id/knowledge/melihat-jumlah-ram-centos.html

Rabu, 15 September 2021

Multi Query MySQL PHP native

MySQL optionally allows having multiple statements in one statement string, but it requires special handling.

Multiple statements or multi queries must be executed with mysqli::multi_query(). The individual statements of the statement string are separated by semicolon. Then, all result sets returned by the executed statements must be fetched.

The MySQL server allows having statements that do return result sets and statements that do not return result sets in one multiple statement. 

Example #1 Multiple Statements

<?php

mysqli_report
(MYSQLI_REPORT_ERROR MYSQLI_REPORT_STRICT);
$mysqli = new mysqli("example.com""user""password""database");

$mysqli->query("DROP TABLE IF EXISTS test");
$mysqli->query("CREATE TABLE test(id INT)");

$sql "SELECT COUNT(*) AS _num FROM test;
        INSERT INTO test(id) VALUES (1); 
        SELECT COUNT(*) AS _num FROM test; "
;

$mysqli->multi_query($sql);

do {
    if (
$result $mysqli->store_result()) {
        
var_dump($result->fetch_all(MYSQLI_ASSOC));
        
$result->free();
    }
} while (
$mysqli->next_result());

 The above example will output:

array(1) {
  [0]=>
  array(1) {
    ["_num"]=>
    string(1) "0"
  }
}
array(1) {
  [0]=>
  array(1) {
    ["_num"]=>
    string(1) "1"
  }
}

Security considerations

The API functions mysqli::query() and mysqli::real_query() do not set a connection flag necessary for activating multi queries in the server. An extra API call is used for multiple statements to reduce the damage of accidental SQL injection attacks. An attacker may try to add statements such as ; DROP DATABASE mysql or ; SELECT SLEEP(999). If the attacker succeeds in adding SQL to the statement string but mysqli::multi_query is not used, the server will not execute the injected and malicious SQL statement. 

Example #2 SQL Injection

<?php
$mysqli 
= new mysqli("example.com""user""password""database");
$result    $mysqli->query("SELECT 1; DROP TABLE mysql.user");
if (!
$result) {
    echo 
"Error executing query: (" $mysqli->errno ") " $mysqli->error;
}
?>
 
The above example will output:
 
Error executing query: (1064) You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax 
to use near 'DROP TABLE mysql.user' at line 1
 
Sumber :
https://www.php.net/manual/en/mysqli.quickstart.multiple-statement.php
https://www.it-swarm-id.com/id/php/menjalankan-beberapa-query-sql-dalam-satu-pernyataan-dengan-php/1070208427/ 

Minggu, 29 Agustus 2021

Install MobSF Ubuntu 20.04.2 LTS

 Update Repository Ubuntu

$ sudo apt get update

Install git
$ sudo apt install git

Install python package
$ sudo apt install python3-pip python3-venv python3-pip python3-dev build-essential libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev zlib1g-dev

Install jdk
$ sudo apt install default-jre

Clone MobSF from github (15/1/2020)
$ sudo git clone https://github.com/MobSF/Mobile-Security-Framework-MobSF.git

Chdir to MobSF clone dir
$ cd Mobile-Security-Framework-MobSF

Run the Setup
$ ./setup.sh

Run MobSF Service
$ ./run.sh

Open MobSF Interface in browser
http://localhost:8000

HOWTO : Install DVWA on Ubuntu 18.04.1 LTS

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is damn vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, help web developers better understand the processes of securing web applications and aid teachers/students to teach/learn web application security in a class room environment.


Step 1 :

sudo apt install php7.2 php7.2-gd php-mysql mysql-server apache2 git

Set the MySQL server password as prompt.

Step 2 :

sudo mysql -u root -p

CREATE DATABASE dvwadb;

GRANT ALL PRIVILEGES ON dvwadb.* TO ‘dvwa’@’localhost’ IDENTIFIED BY ‘dvwapassword’;


Step 3 :

sudo nano /etc/php/7.2/apache2/php.ini

Change the "Off" to "On" :

allow_url_include = On

Step 4 :

cd /var/www/html

sudo git clone https://github.com/ethicalhack3r/DVWA.git

cd /var/www/html/DVWA

sudo chmod 777 /var/www/html/DVWA/config
sudo chmod 666 /var/www/html/DVWA/external/phpids/0.6/lib/IDS/tmp/phpids_log.txt
sudo chmod 777 /var/www/html/DVWA/hackable/uploads/


Step 5 :

sudo nano /etc/apache2/sites-enabled/000-default.conf

Append "/DVWA" as the end of "/var/www/html" :

DocumentRoot /var/www/html/DVWA

Step 6 :

sudo cp /var/www/html/DVWA/config/config.inc.php.dist /var/www/html/DVWA/config/config.inc.php

sudo nano /var/www/html/DVWA/config/config.inc.php


Make changes as the following :

$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwadb';
$_DVWA[ 'db_user' ] = 'dvwa';
$_DVWA[ 'db_password' ] = 'dvwapassword';


Step 7 :

Go to https://www.google.com/recaptcha/admin to generate the keys for 'Insecure CAPTCHA' module and add to the related items at "config.inc.php".

Step 8 :

sudo systemctl restart apache2

Step 9 :

http://[server_ip_address]

The username is "admin" while the password is "password".

Beware that the DVWA is vulnerable and do not allow it to be accessed via public.

Step 10 (Optional) :

sudo apt install php7.2-fpm

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm


That's all! See you.

Sabtu, 19 Juni 2021

Disable Auto Update Proxmox Environment 5-2-5

 Cara menonaktifkan auto update pada Proxmox 5-2-5

#systemctl status pve-daily-update.timer
Output
● pve-daily-update.timer - Daily PVE download activities
   Loaded: loaded (/lib/systemd/system/pve-daily-update.timer; enabled; vendor p
   Active: active (waiting) since Sat 2021-06-19 21:51:12 WIB; 16min ago

Jun 19 21:51:12 drc-ebanking systemd[1]: pve-daily-update.timer: Adding 3h 42min
Jun 19 21:51:12 drc-ebanking systemd[1]: Started Daily PVE download activities.


#systemctl stop pve-daily-update.timer
#systemctl disable pve-daily-update.timer

Output
● pve-daily-update.timer - Daily PVE download activities
   Loaded: loaded (/lib/systemd/system/pve-daily-update.timer; disabled; vendor
   Active: inactive (dead)

Jun 19 21:51:12 drc-ebanking systemd[1]: pve-daily-update.timer: Adding 3h 42min
Jun 19 21:51:12 drc-ebanking systemd[1]: Started Daily PVE download activities.
Jun 19 22:12:05 drc-ebanking systemd[1]: Stopped Daily PVE download activities.

Senin, 19 April 2021

Menambahkan Swap pada Linux Ubuntu 18.04

 Pada umumnya swap dibuat dalam partisi Linux. Tapi bagaimana jika sistem Linux yang berjalan tidak terdapat partisi swap seperti pada Linux VPS (Virtual Private Server), hanya tersedia partisi / (root) saja. Solusinya adalah dengan membuat swap file.

1. perintah free -h Terlihat nilai total Swap = 0 apabila tidak ada swap akti.
2. Menyiapkan Swap File
   Di sini kita akan membuat swap file sebesar 2GB menggunakan perintah dd. bs=1024 adalah baca dan tulis sebesar 1024 byte dalam    satu waktu. Dan count=(1024×2048) ukuran file/block.

   sudo dd if=/dev/zero of=/swapfile bs=1024 count=2097152

3. Mengaktifkan Swap File
   Selanjutnya menjadikan swapfile sebagai swap dengan perintah mkswap.

   sudo mkswap /swapfile

4. Selanjutnya mengaktifkan swap dengan perintah swapon.

   sudo swapon /swapfile

   sudo swapoff -a bila akan menonaktifkan swap

5. Jalankan perintah free -h untuk melihat RAM dan Swap. Pada gambar di bawah ini, terdapat Swap dengan kapasitas 2GB.

6. Auto mount Swap
   Agar Swap langsung aktif secara otomatis ketika sistem boot, tambahkan konfigurasi pada file /etc/fstab.

   sudo nano /etc/fstab

   Tambahkan
   /swapfile none swap sw 0  0

7. sudo reboot


Salam

Partisi ext4 tambahan pada linux Ubuntu

 Dalam linux terdapat beberapa partisi hampir sama dengan OS Windows yaitu ada C,D,E dan seterusnya
kalau partisi pada OS linux mulai dari sda, sdb, sdc dan seterusnya
apabila kita akan meambahkan Hardware baru ( HDD baru) maka cukup menambahkan perintah sebagai berikut dengan menyesuaikan hdd yang terbaca pada system, sebagai contoh akan memartisi hdd dengan id sdb

mkfs.ext4 /dev/sdb 2>/dev/null

 

salam