Skip to main content

!#!#< I CREATE A WATCHER IN MY WP WEBSITE > #!#!

Watcher in my Wordpress: 


FINALLY! i got some free time to do my own project that i like.

so hey guys i hope most of you have great months and it is been 1 month since i update my blog, it has been a hectic month for me because the project is keep coming and apparently i only have little time to finish it (i hope i could survive in the end of the months :D #LOL).

So just to make thing quick i just going to straight explaining the "little project" that i just two days ago made.

my pet project is about creating a watcher in my wp login website. so everytime someone try to go to my login page it record their ip address, browser and time to the log file.

I know! most of you think that it is actually useless because the apache already have a log(var/log/apache2) and you can just see it straight away. YES! it is true but the drawback is that you may not have your laptop all the time right?. so just to make things simple i'm just going to make application android that will fetch the log file anytime and anywhere and show it to me without bringing laptop everywhere.

ok so that was the idea, lets make it happen:

because it is pretty simple all i need to do is just creating simple log php page and inserted to the wp-login.php. After i finish making the php script, next is to creating the android application.

First Step: Creating the PHP script

creating log php script require you to use $_SERVER function, according to the official documentation page "is an array containing information such as headers, paths, and script locations" (url:http://php.net/manual/en/reserved.variables.server.php). The entries in this array are created by the web server" so it automatically handle the server request and listed it to us.

For the project I only need 2 METHODS from $_SERVER function:

$_SERVER['REMOTE_ADDR'] for to get the ip address of the unknown visitor

$_SERVER['HTTP_USER_AGENT' for to get the browser that they use

and last thing is the date i use:

date('y/m/d G:i:s') format

ok so i have all the part for creating script:

<?php

$ip_address_for = $_SERVER['REMOTE_ADDR'];
$browser = $_SERVER['HTTP_USER_AGENT'];

$datetime = date('y/m/d G:i:s');

$file = "log_login49C03561A170F247B818E3D04B25B29C.txt";

$file = fopen($file,"a");
$data = "ip address: $ip_address_for \nbrowser: $browser \ndate: $datetime \n+======================+ \n";

fwrite($file,$encrypted_data);
fclose($file);

?>


i put the script inside the wp-login.php in my web hosting


and done! once someone go to login page it will create log_login file and you can see it right away. the reason why i put hash value after the name of the file is that i don't want the log file is easily to be spot on my website for security practice ish.

Second and the Last Step: Creating the Android Application

 in my android application i created three method that will handle the url connection and putting the log into the interface.

openhttpconnection() for initiate the http connection to the website
downloadtext() for download the log text file
downloadtexttask() for asynctask

If you want to see the code fell free to check my github repo,link

the result will be like the snipped picture:


pretty easy right ? you can follow along and try putting new features to the app for yourself. Well, for myself this kind of apps is still need more feature and update. i plan to put some features such as whois query and port scanning to the the apps so it could be function as a mini SOC in the android phone

ok i think that's all folks, i will update the part 2 soon. in part 2 i will show the update of the apps so it will cover a basic network tools to query information about the ip inside the log


peace out yoooo ~




Comments

Popular posts from this blog

Having fun analyzing nginx log to find malicious attacker in the net (ง'̀-'́)ง (day 37)

  What makes you sleepless at night? is it because of a ghost or scary stories? is it because you have an important meeting tomorrow? or is it because you have an exam? For me, what keeps me up all night is that I keep thinking about what happens to a website that I just created, is it safe from an attacker (certainly not) or did I missing some security adjustments that lead to vulnerability? well I'm not the best secure programmer in the world, I'm still learning and there is a big possibility that I can make a mistake but for me, a mistake can be a valuable investment to myself or yourself to be better so from this idea, I want to know more about what attackers casually do when attacking a website. Here in this post, I'm going to show you how I analyzed attack to the website that I have permission to design and also some interesting findings that I could get from the analysis Background: All of this analysis comes from the traffic that is targeted to th

Utilize Pwntools for crafting ROP chain :') (day 69)

who doesn't like pwntools? it is a very versatile tool and can be customized according to our need using the python script but did you need to know that pwntools itself can help us to automatically craft a rop chain for us? so in this post, I will show you how to make rop chain less painful and make pwntools do all the heavy lifting. To demonstrate this I will use the binary challenge callme 64 bit from ropemporium link: https://ropemporium.com/challenge/callme.html Crashing the app: Like any other exploitation process, we need to crash the program by generating a long string pattern to determine the offset. based on the information from the above figure we can see that we required to provide 40 bytes of offset Fun stuff: now this where the fun stuff began write the following python script: as in the guideline of the challenged said we need to chain the function call by first to call the callme_one function, callme_two function and then callme_three funct

WriteUp PWN tarzan ROP UNICTF ಠ_ಠ (day 61)

So in this post, I'm going to talk about how to solve the Tarzan pwn challenge from UNICTF 2019. Back in the day when the competition is still going I couldn't finish it and don't have any clue to solve this but this time I was able to finish it :) Also in this post, we will be going to be heavily focused on how to utilize pwntools to construct a ROP chain. If you kinda confused about my explanation in this post you can refer to this following youtube video, link: https://www.youtube.com/watch?v=gWU2yOu0COk I build the python script based on this video Ok, let's get started! In this challenge, you will get two binary first go with tarzan and libc-2.29.so by providing .so file it tell us what version library that the target machine is using this could help us to do ROP chain. first, we run the Tarzan binary to get the basic idea of the program work and as you can see it just show you some text, newline and when you try to input something it doesn't gi