language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/default.html
<meta name='robots' content='noindex,follow' /> <link rel='stylesheet' id='twentyfourteen-lato-css' href='//fonts.googleapis.com/css?family=Lato%3A300%2C400%2C700%2C900%2C300italic%2C400italic%2C700italic' type='text/css' media='all' /> <link rel='stylesheet' id='genericons-css' href='http://ex.lo/wordpress-4.0/wp-content/themes/twentyfourteen/genericons/genericons.css?ver=3.0.3' type='text/css' media='all' /> <link rel='stylesheet' id='twentyfourteen-style-css' href='http://ex.lo/wordpress-4.0/wp-content/themes/twentyfourteen/style.css?ver=4.0' type='text/css' media='all' />
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/meta_generator.html
<meta name="description" content="spec file"/> <link rel="canonical" href="http://wp.lab/" /> <meta property="og:type" content="website" /> <meta name="generator" content="Powered by Rspec - drag and drop page builder for WordPress."/>
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/mu_plugins.html
<link rel='stylesheet' id='NextGEN-css' href='http://ex.lo/wordpress-4.0/wp-content/mu-plugins/nextgen-gallery/css/nggallery.css?ver=1.0.0' type='text/css' media='screen' />
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/not_wp.html
<head> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8;charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=1" /> <meta name="HandheldFriendly" content="true"/> <link rel="canonical" href="https://duckduckgo.com/">
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/only_scripts.html
<script type='text/javascript' src='http://ex.lo/wordpress-4.0/wp-includes/js/jquery/jquery.js?ver=1.11.1'></script>
PHP
wpscan/spec/fixtures/target/platform/wordpress/detection/wp-admin-install.php
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <head> <meta name="viewport" content="width=device-width" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex,nofollow" /> <title>WordPress &rsaquo; Installation</title> <link rel='stylesheet' id='buttons-css' href='https://ex.lo/wp-includes/css/buttons.min.css?ver=5.0.3' type='text/css' media='all' /> <link rel='stylesheet' id='install-css' href='https://ex.lo/wp-admin/css/install.min.css?ver=5.0.3' type='text/css' media='all' /> <link rel='stylesheet' id='dashicons-css' href='https://ex.lo/wp-includes/css/dashicons.min.css?ver=5.0.3' type='text/css' media='all' /> </head> <body class="wp-core-ui"> <p id="logo"><a href="https://wordpress.org/" tabindex="-1">WordPress</a></p> <h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p><p class="step"><a href="https://ex.lo/wp-login.php" class="button button-large">Log In</a></p></body></html>
PHP
wpscan/spec/fixtures/target/platform/wordpress/detection/wp-login.php
<!DOCTYPE html> <!--[if IE 8]> <html xmlns="http://www.w3.org/1999/xhtml" class="ie8" lang="en-US"> <![endif]--> <!--[if !(IE 8) ]><!--> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <!--<![endif]--> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Log In WP Lab</title> <link rel='dns-prefetch' href='//s.w.org' /> <link rel='stylesheet' id='dashicons-css' href='https://ex.lo/wp-includes/css/dashicons.min.css?ver=5.0.3' type='text/css' media='all' /> <link rel='stylesheet' id='buttons-css' href='https://ex.lo/wp-includes/css/buttons.min.css?ver=5.0.3' type='text/css' media='all' /> <link rel='stylesheet' id='forms-css' href='https://ex.lo/wp-admin/css/forms.min.css?ver=5.0.3' type='text/css' media='all' /> <link rel='stylesheet' id='l10n-css' href='https://ex.lo/wp-admin/css/l10n.min.css?ver=5.0.3' type='text/css' media='all' /> <link rel='stylesheet' id='login-css' href='https://ex.lo/wp-admin/css/login.min.css?ver=5.0.3' type='text/css' media='all' /> <meta name='robots' content='noindex,noarchive' /> <meta name='referrer' content='strict-origin-when-cross-origin' /> <meta name="viewport" content="width=device-width" /> </head> <body class="login login-action-login wp-core-ui locale-en-us"> <div id="login"> <h1><a href="https://ex.lo/" title="WP Lab" tabindex="-1">WP Lab</a></h1> <form name="loginform" id="loginform" action="https://ex.lo/wp-login.php" method="post"> <p> <label for="user_login">Username or Email Address<br /> <input type="text" name="log" id="user_login" class="input" value="" size="20" /></label> </p> <p> <label for="user_pass">Password<br /> <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label> </p> <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" /> Remember Me</label></p> <p class="submit"> <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Log In" /> <input type="hidden" name="redirect_to" value="https://ex.lo/wp-admin/" /> <input type="hidden" name="testcookie" value="1" /> </p> </form> <p id="nav"> <a href="https://ex.lo/wp-login.php?action=lostpassword">Lost your password?</a> </p> <script type="text/javascript"> function wp_attempt_focus(){ setTimeout( function(){ try{ d = document.getElementById('user_login'); d.focus(); d.select(); } catch(e){} }, 200); } wp_attempt_focus(); if(typeof wpOnload=='function')wpOnload(); </script> <p id="backtoblog"><a href="https://ex.lo/">&larr; Back to WP Lab</a></p> </div> <div class="clear"></div> </body> </html>
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/wp_admin.html
<script data-cfasync='false'> //<![CDATA[ _SHR_SETTINGS = {"endpoints":{"local_recs_url":"https:\/\/ex.lo\/wp-admin\/admin-ajax.php?action=shareaholic_permalink_related","ajax_url":"http:\/\/ex.lo\/wp-admin\/admin-ajax.php"},"url_components":{"year":"2019","monthnum":"03","day":"16","hour":"21","minute":"02","second":"33","post_id":"8","postname":"post1","category":"uncategorized"}}; //]]> </script>
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/wp_includes.html
<script type='text/javascript' src='http://ex.lo/wordpress-4.0/wp-includes/js/jquery/jquery.js?ver=1.11.1'></script> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://ex.lo/wordpress-4.0/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://ex.lo/wordpress-4.0/wp-includes/wlwmanifest.xml" />
HTML
wpscan/spec/fixtures/target/platform/wordpress/detection/wp_json_oembed.html
<link rel="alternate" type="application/json+oembed" href="https://ex.lo/wp-json/oembed/1.0/embed?url=https%3A%2F%2Fex.lo%2F" /> <link rel="alternate" type="text/xml+oembed" href="http://ex.lo/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fex.lo%2F&#038;format=xml" />
HTML
wpscan/spec/fixtures/target/platform/wordpress/maybe_add_cookies/vjs.html
<html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta name="robots" content="noindex"> </head> <body> <script> function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } createCookie('vjs','2420671338',60); </script><form id="repost" method="post" action=""></form> <script> if((document.cookie.indexOf('vjs=') !== -1)) location.reload(); </script> <h1>Access to this website is possible only using browser with JavaScript and Cookies enabled.</h1>
HTML
wpscan/spec/fixtures/target/platform/wordpress/wordpress_hosted/match_href.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>WP Lab</title> <link rel="stylesheet" href="https://s2.wp.com/wp-content/themes/vip/lab/style.css" type="text/css" media="screen" /> <link rel="pingback" href="http://ex.lo/xmlrpc.php" /> <script src='https://r-login.wordpress.com/remote-login.php?action=js&amp;host=ex.lo&amp;id=18579156&amp;t=1555586446&amp;back=http%3A%2F%2Fex.lo%2F' type="text/javascript"></script> <script type="text/javascript"> /* <![CDATA[ */ if ( 'function' === typeof WPRemoteLogin ) { document.cookie = "wordpress_test_cookie=test; path=/"; if ( document.cookie.match( /(;|^)\s*wordpress_test_cookie\=/ ) ) { WPRemoteLogin(); } } /* ]]> */ </script> <link rel='dns-prefetch' href='//s2.wp.com' /> <link rel='dns-prefetch' href='//s0.wp.com' /> <link rel='dns-prefetch' href='//s1.wp.com' /> <link rel='dns-prefetch' href='//lab.wordpress.com' /> <link rel="alternate" type="application/rss+xml" title="WP Lab &raquo; Feed" href="http://ex.lo/feed/" /> <link rel="alternate" type="application/rss+xml" title="WP Lab &raquo; Comments Feed" href="http://ex.lo/comments/feed/" /> <script type="text/javascript"> /* <![CDATA[ */ function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function () { oldonload(); func(); } } } /* ]]> */ </script> <script type="text/javascript"> window._wpemojiSettings = {"baseUrl":"https:\/\/s0.wp.com\/wp-content\/mu-plugins\/wpcom-smileys\/twemoji\/2\/72x72\/","ext":".png","svgUrl":"https:\/\/s0.wp.com\/wp-content\/mu-plugins\/wpcom-smileys\/twemoji\/2\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/s2.wp.com\/wp-includes\/js\/wp-emoji-release.min.js?m=1550249335h&ver=5.2-beta3-45232"}}; !function(a,b,c){function d(a,b){var c=String.fromCharCode;l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,a),0,0);var d=k.toDataURL();l.clearRect(0,0,k.width,k.height),l.fillText(c.apply(this,b),0,0);var e=k.toDataURL();return d===e}function e(a){var b;if(!l||!l.fillText)return!1;switch(l.textBaseline="top",l.font="600 32px Arial",a){case"flag":return!(b=d([55356,56826,55356,56819],[55356,56826,8203,55356,56819]))&&(b=d([55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447],[55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447]),!b);case"emoji":return b=d([55358,56760,9792,65039],[55358,56760,8203,9792,65039]),!b}return!1}function f(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var g,h,i,j,k=b.createElement("canvas"),l=k.getContext&&k.getContext("2d");for(j=Array("flag","emoji"),c.supports={everything:!0,everythingExceptFlag:!0},i=0;i<j.length;i++)c.supports[j[i]]=e(j[i]),c.supports.everything=c.supports.everything&&c.supports[j[i]],"flag"!==j[i]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[j[i]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(h=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",h,!1),a.addEventListener("load",h,!1)):(a.attachEvent("onload",h),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),g=c.source||{},g.concatemoji?f(g.concatemoji):g.wpemoji&&g.twemoji&&(f(g.twemoji),f(g.wpemoji)))}(window,document,window._wpemojiSettings); </script> <style type="text/css"> img.wp-smiley, img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 .07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important; } </style> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://lab.wordpress.com/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://s1.wp.com/wp-includes/wlwmanifest.xml" /> <meta name="generator" content="WordPress.com" /> <link rel='shortlink' href='https://wp.me/1fXhO' /> <link rel='openid.server' href='http://lab.wordpress.com/?openidserver=1' /> <link rel='openid.delegate' href='http://lab.wordpress.com/' /> <link rel="search" type="application/opensearchdescription+xml" href="http://ex.lo/osd.xml" title="WP Lab" /> <link rel="search" type="application/opensearchdescription+xml" href="https://s1.wp.com/opensearch.xml" title="WordPress.com" /> <script type="text/javascript"> jQuery(function($){ $.fn.colorbox.settings.transition = "elastic"; $.fn.colorbox.settings.speed = 350; $.fn.colorbox.settings.maxWidth = "false"; $.fn.colorbox.settings.maxHeight = "false"; $.fn.colorbox.settings.resize = true; $.fn.colorbox.settings.opacity = 0.8; $.fn.colorbox.settings.preloading = true; $.fn.colorbox.settings.current = "Image {current} of {total}"; $.fn.colorbox.settings.previous = "previous"; $.fn.colorbox.settings.next = "next"; $.fn.colorbox.settings.close = "close"; $.fn.colorbox.settings.overlayClose = true; $.fn.colorbox.settings.slideshow = false; $.fn.colorbox.settings.slideshowAuto = true; $.fn.colorbox.settings.slideshowSpeed = 2500; $.fn.colorbox.settings.slideshowStart = "start"; $.fn.colorbox.settings.slideshowStop = "stop"; $("a[rel*='lightbox']").colorbox(); }); </script> <link rel="stylesheet" type="text/css" href="https://s0.wp.com/wp-content/themes/vip/plugins/lightbox-plus//css/shadowed/colorbox.css" media="screen" /> <!--[if IE]> <link type="text/css" media="screen" rel="stylesheet" href="https://s0.wp.com/wp-content/themes/vip/plugins/lightbox-plus//css/shadowed/colorbox-ie.css" title="IE fixes" /> <![endif]--> <meta name="application-name" content="WP Lab" /><meta name="msapplication-window" content="width=device-width;height=device-height" /><meta name="msapplication-task" content="name=Subscribe;action-uri=http://ex.lo/feed/;icon-uri=https://s1.wp.com/i/favicon.ico" /><style type="text/css" id="syntaxhighlighteranchor"></style> <link rel="shortcut icon" href="https://s2.wp.com/wp-content/themes/vip/lab/images/favicon.ico" type="image/vnd.microsoft.icon"> <!--Script needed to render twitter follow button--> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> <!-- <script> function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } var splash = readCookie("seensplash"); var isiPad = navigator.userAgent.match(/iPad/i) != null; if(splash == null && !isiPad && window.location.toString().indexOf("ex.lo") > -1) { document.location.href="/intro/"; } </script> --> <style type="text/css"> .nav { background:url(https://s2.wp.com/wp-content/themes/vip/lab/images/bg2.png) repeat; } .post { background:url(https://s2.wp.com/wp-content/themes/vip/lab/images/int_border.png); } #double_container { background:url(https://s2.wp.com/wp-content/themes/vip/lab/images/copy_bg.png); } .main_container { background:none; width:1050px; margin:0 auto;); } div.post_footer { background:#ffffff url(https://s2.wp.com/wp-content/themes/vip/lab/images/post_sep.png) no-repeat; } div.widget_footer { background:#ffffff url(https://s2.wp.com/wp-content/themes/vip/lab/images/post_sep.png); } div.break_footer { background:#ffffff url(https://s2.wp.com/wp-content/themes/vip/lab/images/post_sep.png); } .pushbutton-wide { background:url(https://s2.wp.com/wp-content/themes/vip/lab/images/submit.gif); } #sidebar .pds-vote-button { background:url(https://s2.wp.com/wp-content/themes/vip/lab/images/submit.gif); } /* Nav Style */ .cbNav { background:url('https://s2.wp.com/wp-content/themes/vip/lab/images/nav.png') 0 0 no-repeat; width:1005px; height:54px; z-index:20; position:absolute; left:1px; top:58px; } .cbNav ul { border:0; margin:0; list-style-type:none; } .cbNav li { background:url('https://s2.wp.com/wp-content/themes/vip/lab/images/nav-sprite.png') 0 0 no-repeat; list-style-type:none; margin:0; padding:0; position:absolute; top:10px; height:28px; } .cbNav li.bio { left:91px; width:56px; } .cbNav li.video { left:177px; width:79px; } .cbNav li.photos { left:277px; width:92px; } .cbNav li.contests { left:395px; width:107px; } .cbNav li.press { left:529px; width:75px; } .cbNav li.contact { left:629px; width:103px; } /* .cbNav li.photos { display:none; } .cbNav li.contests { left:270px; width:107px; } .cbNav li.press { left:413px; width:75px; } .cbNav li.contact { left:514px; width:103px; } */ .cbNav li a, .cbNav li a:hover { display:block; width:100%; height:100%; } .cbNav li.bio { background-position:-92px -64px; } .cbNav li.video { background-position:-178px -64px; } .cbNav li.photos { background-position:-278px -64px; } .cbNav li.contests { background-position:-396px -64px; } .cbNav li.press { background-position:-530px -64px; } .cbNav li.contact { background-position:-630px -64px; } .cbNav li.bio:hover { background-position:-91px -10px; } .cbNav li.video:hover { background-position:-177px -10px; } .cbNav li.photos:hover { background-position:-277px -10px; } .cbNav li.contests:hover { background-position:-395px -10px; } .cbNav li.press:hover { background-position:-529px -10px; } .cbNav li.contact:hover { background-position:-629px -10px; } .cbNav li .subnav { background:url('https://s2.wp.com/wp-content/themes/vip/lab/images/nav_sub_bg.png') repeat-x; height:28px; display:none; position:absolute; bottom:-25px; left:0; } .cbNav li:hover .subnav { display:block; } .cbNav .subnavEnds { background:url('https://s2.wp.com/wp-content/themes/vip/lab/images/nav_sub_ends-sprite.png') 0 0 no-repeat; width:7px; height:28px; position:absolute; } .cbNav .leftEnd { left:-7px; top:0; } .cbNav .rightEnd { right:-7px; top:0; background-position:-7px 0; } .cbNav .subnav a {background:none; display:inline; color:#fff; text-decoration:none; line-height:24px; padding:5px; font-family:calibri, sans-serif; font-size:13px;} .cbNav .subnav a:hover {background:none; display:inline; color:#c90; text-decoration:underline; text-shadow:0.1em 0.1em #333; line-height:24px; } .cbNav form { position:absolute; top:9px; right:17px; float:right; width:227px; height:30px; } .cbNav .cbSearch { float:left; width:188px; height:30px; line-height:30px; background:none; border:0; position:relative; left:4px; color:#909090; font-size:11px; font-weight:bold; } .cbNav form .submit { background:url('http://i.cdn.turner.com/nba/nba/images/1.gif') 0 0 no-repeat; width:30px; height:30px; float:right; border:0; margin:0; padding:0; cursor:pointer; } </style> <script language="JavaScript"> document.adoffset = 0; document.adPopupFile = '/cnn_adspaces/adsPopup2.html'; </script> <script type="text/javascript" src="http://i.cdn.turner.com/ads/adfuel/ais/nba-ais.js"></script> <script language="JavaScript"> $(document).ready(function() { $('#content').append($('#footer')); }); </script> </head> <body class="home blog mp6 customizer-styles-applied" style="background:url(https://s2.wp.com/wp-content/themes/vip/lab/images/bg2.png);"> <div class="main_container"> </body> </html>
HTML
wpscan/spec/fixtures/target/platform/wordpress/wordpress_hosted/match_src.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>WP Lab</title> <script type="text/javascript" src="https://s2.wp.com/wp-content/themes/vip/lab/js/jquery-1.8.3.min.js"></script> <script type="text/javascript" src="https://s2.wp.com/wp-content/themes/vip/lab/js/jquery.vticker-min.js"></script> <script type="text/javascript" src="https://s2.wp.com/wp-content/themes/vip/lab/js/adspaces.js"></script> <script type="text/javascript" src="https://s2.wp.com/wp-content/themes/vip/lab/js/nbaOmEvent.js"></script>
HTML
wpscan/spec/fixtures/target/platform/wordpress/wordpress_hosted/no_match.html
<link rel="pingback" href="http://ex.lo/xmlrpc.php" /> <link rel="stylesheet" href="https://a.cloudfront.net/wp-content/themes/vip/lab/style.css" type="text/css" media="screen" />
Ruby
wpscan/spec/lib/browser_spec.rb
# frozen_string_literal: true describe WPScan::Browser do subject(:browser) { described_class.instance(options) } let(:options) { {} } before { described_class.reset } describe '#user_agent' do context 'when not set' do its(:user_agent) { should eq "WPScan v#{WPScan::VERSION} (https://wpscan.com/wordpress-security-scanner)" } end context 'when set' do let(:options) { super().merge(user_agent: 'Custom UA') } its(:user_agent) { should eq options[:user_agent] } end end end
Ruby
wpscan/spec/lib/helper_spec.rb
# frozen_string_literal: true describe '#classify_slug' do { 'slug' => :Slug, 'slug-usual' => :SlugUsual, '12-slug' => :D_12Slug, 'slug.s' => :SlugS, 'slug yolo $' => :SlugYolo, 'slug $ ab.cd/12' => :SlugAbCd12 }.each do |slug, expected_symbol| context "when #{slug}" do it "returns #{expected_symbol}" do expect(classify_slug(slug)).to eql expected_symbol end end end end
Ruby
wpscan/spec/lib/target_spec.rb
# frozen_string_literal: true describe WPScan::Target do subject(:target) { described_class.new(url, opts) } let(:url) { 'http://ex.lo' } let(:opts) { {} } it_behaves_like WPScan::Target::Platform::WordPress describe 'xmlrpc' do before do allow(target).to receive(:sub_dir) expect(target).to receive(:interesting_findings).and_return(interesting_findings) end context 'when no interesting_findings' do let(:interesting_findings) { [] } its(:xmlrpc) { should be_nil } end context 'when interesting_findings' do let(:interesting_findings) { ['aa', CMSScanner::Model::RobotsTxt.new(target.url)] } context 'when no XMLRPC' do its(:xmlrpc) { should be_nil } end context 'when XMLRPC' do let(:xmlrpc) { WPScan::Model::XMLRPC.new(target.url('xmlrpc.php')) } let(:interesting_findings) { super() << xmlrpc } its(:xmlrpc) { should eq xmlrpc } end end end %i[wp_version main_theme plugins themes timthumbs config_backups db_exports medias users].each do |method| describe "##{method}" do let(:methods) { %i[wp_version main_theme] } before do return_value = methods.include?(method) ? false : [] expect(WPScan::Finders.const_get("#{method.to_s.camelize}::Base")) .to receive(:find).with(target, opts).and_return(return_value) end after { target.send(method, opts) } let(:opts) { {} } context 'when no options' do it 'calls the finder with the correct arguments' do # handled by before hook end end context 'when options' do let(:opts) { { mode: :passive, somthing: 'k' } } it 'calls the finder with the corect arguments' do # handled by before hook end end context 'when called multiple times' do it 'calls the finder only once' do target.send(method, opts) end end end end describe '#vulnerable?' do context 'when all attributes are nil' do it { should_not be_vulnerable } end context 'when wp_version is not found' do before { target.instance_variable_set(:@wp_version, false) } it { should_not be_vulnerable } end context 'when wp_version found' do before do expect(wp_version) .to receive(:db_data) .and_return(vuln_api_data_for("wordpresses/#{wp_version.number.tr('.', '')}")) target.instance_variable_set(:@wp_version, wp_version) end context 'when not vulnerable' do let(:wp_version) { WPScan::Model::WpVersion.new('4.0') } it { should_not be_vulnerable } end context 'when vulnerable' do let(:wp_version) { WPScan::Model::WpVersion.new('3.8.1') } it { should be_vulnerable } end end context 'when config_backups' do before do target.instance_variable_set(:@config_backups, [WPScan::Model::ConfigBackup.new(target.url('/a-file-url'))]) end it { should be_vulnerable } end context 'when db_exports' do before do target.instance_variable_set(:@db_exports, [WPScan::Model::DbExport.new(target.url('/wordpress.sql'))]) end it { should be_vulnerable } end context 'when users' do before do target.instance_variable_set(:@users, [WPScan::Model::User.new('u1'), WPScan::Model::User.new('u2')]) end context 'when no passwords' do it { should_not be_vulnerable } end context 'when at least one password has been found' do before { target.users[1].password = 'owned' } it { should be_vulnerable } end end end end
Ruby
wpscan/spec/lib/vulnerability_spec.rb
# frozen_string_literal: true describe WPScan::Vulnerability do subject(:vuln) { described_class.new(title, references: references) } let(:title) { 'Test Vuln' } let(:references) { {} } it_behaves_like WPScan::References describe '#load_from_json' do # Handled in spec/app/models/wp_version_spec#vulnerabilities end end
Ruby
wpscan/spec/lib/wpscan_spec.rb
# frozen_string_literal: true describe WPScan do it 'has a version number' do expect(WPScan::VERSION).not_to be nil end describe '#app_name' do it 'returns the overriden string' do expect(WPScan.app_name).to eql 'wpscan' end end end
Ruby
wpscan/spec/lib/db/fingerprints_spec.rb
# frozen_string_literal: true describe WPScan::DB::Fingerprints do describe '#unique_fingerprints' do # Handled in #wp_unique_fingerprints end describe '.wp_fingerprints' do it 'returns the expected value' do expect(described_class.wp_fingerprints).to eql( 'path-1' => { 'hash-1' => %w[4.0 3.8], 'hash-2' => ['4.4'] }, 'path-2' => { 'hash-3' => %w[3.8.1 3.8.2 3.9.1] } ) end end describe '.wp_unique_fingerprints' do it 'returns the expected value' do expect(described_class.wp_unique_fingerprints).to eql('path-1' => { 'hash-2' => '4.4' }) end end end
Ruby
wpscan/spec/lib/db/plugins_spec.rb
# frozen_string_literal: true describe WPScan::DB::Plugins do subject(:plugins) { described_class } describe '#all_slugs' do its(:all_slugs) { should eql %w[no-vulns-popular vulnerable-not-popular] } end describe '#popular_slugs' do its(:popular_slugs) { should eql %w[no-vulns-popular] } end describe '#vulnerable_slugs' do its(:vulnerable_slugs) { should eql %w[vulnerable-not-popular] } end end
Ruby
wpscan/spec/lib/db/plugin_spec.rb
# frozen_string_literal: true describe WPScan::DB::Plugin do describe '#vulnerabilities' do # Handled in spec/app/models/plugin_spec end end
Ruby
wpscan/spec/lib/db/themes_spec.rb
# frozen_string_literal: true describe WPScan::DB::Themes do subject(:themes) { described_class } describe '#all_slugs' do its(:all_slugs) { should eql %w[no-vulns-popular vulnerable-not-popular dignitas-themes yaaburnee-themes] } end describe '#popular_slugs' do its(:popular_slugs) { should eql %w[no-vulns-popular dignitas-themes] } end describe '#vulnerable_slugs' do its(:vulnerable_slugs) { should eql %w[vulnerable-not-popular dignitas-themes yaaburnee-themes] } end end
Ruby
wpscan/spec/lib/db/theme_spec.rb
# frozen_string_literal: true describe WPScan::DB::Theme do describe '#vulnerabilities' do # Handled in spec/app/models/theme_spec end end
Ruby
wpscan/spec/lib/db/vuln_api_spec.rb
# frozen_string_literal: true describe WPScan::DB::VulnApi do subject(:api) { described_class } let(:request_headers) do { 'User-Agent' => WPScan::Browser.instance.default_user_agent, 'Authorization' => "Token token=#{api.token}" } end before do # Reset the default_request_params api.instance_variable_set(:@default_request_params, nil) end describe '#uri' do its(:uri) { should be_a Addressable::URI } end describe '#token, @token=' do context 'when no token set' do before { api.token = nil } # In case it was set by a previous spec its(:token) { should be nil } end context 'when token set' do it 'returns it' do api.token = 's3cRet' expect(api.token).to eql 's3cRet' end end end describe '#get' do context 'when no token' do before { api.token = nil } it 'returns an empty hash' do expect(api.get('test')).to eql({}) end end context 'when a token' do before { api.token = 's3cRet' } let(:path) { 'path' } context 'when params used' do it 'ensures they override the defaults' do expect(Typhoeus).to receive(:get) .with(api.uri.join(path), hash_including(cache_ttl: 0)) .and_return(Typhoeus::Response.new(code: 404)) api.get(path, cache_ttl: 0) end end context 'when no timeouts' do before do stub_request(:get, api.uri.join(path)) .with(headers: request_headers) .to_return(status: code, body: body) end context 'when 200' do let(:code) { 200 } let(:body) { { data: 'something' }.to_json } it 'returns the expected hash' do expect(api.get(path)).to eql('data' => 'something') end end context 'when 403' do let(:code) { 403 } let(:body) { { status: 'forbidden' }.to_json } it 'returns the expected hash' do expect(api.get(path)).to eql('status' => 'forbidden') end end context 'when 404' do let(:code) { 404 } let(:body) { { error: 'Not found' }.to_json } it 'returns an empty hash' do expect(api.get(path)).to eql({}) end end context 'when 429 (API Limit Reached)' do let(:code) { 429 } let(:body) { { status: 'rate limit hit' }.to_json } it 'returns an empty hash' do expect(api.get(path)).to eql({}) end end end context 'when timeouts' do context 'when all requests timeout' do before do stub_request(:get, api.uri.join('path')) .with(headers: request_headers) .to_return(status: 0) end it 'tries 3 times and returns the hash with the error' do expect(api).to receive(:sleep).with(1).exactly(3).times result = api.get('path') expect(result['http_error']).to be_a WPScan::Error::HTTP expect(api.default_request_params[:headers]['X-Retry']).to eql 3 end end context 'when only the first request timeout' do before do stub_request(:get, api.uri.join('path')) .with(headers: request_headers) .to_return(status: 0).then .to_return(status: 200, body: { data: 'test' }.to_json) end it 'tries 1 time and returns expected data' do expect(api).to receive(:sleep).with(1).exactly(1).times expect(api.get('path')).to eql('data' => 'test') expect(api.default_request_params[:headers]['X-Retry']).to eql 1 end end end end end describe '#plugin_data' do before { api.token = api_token } context 'when no --api-token' do let(:api_token) { nil } it 'returns an empty hash' do expect(api.plugin_data('slug')).to eql({}) end end context 'when valid --api-token' do let(:api_token) { 's3cRet' } context 'when the slug exist' do it 'calls the correct URL' do stub_request(:get, api.uri.join('plugins/slug')) .to_return(status: 200, body: { slug: { p: 'aa' } }.to_json) expect(api.plugin_data('slug')).to eql('p' => 'aa') end end context 'when the slug does not exist' do it 'returns an empty hash' do stub_request(:get, api.uri.join('plugins/slug-404')).to_return(status: 404, body: '{}') expect(api.plugin_data('slug-404')).to eql({}) end end context 'when API limit reached' do it 'returns an empty hash' do stub_request(:get, api.uri.join('plugins/slug-429')) .to_return(status: 429, body: { status: 'rate limit hit' }.to_json) expect(api.plugin_data('slug-429')).to eql({}) end end end end describe '#theme_data' do before { api.token = api_token } context 'when no --api-token' do let(:api_token) { nil } it 'returns an empty hash' do expect(api.theme_data('slug')).to eql({}) end end context 'when valid --api-token' do let(:api_token) { 's3cRet' } context 'when the slug exist' do it 'calls the correct URL' do stub_request(:get, api.uri.join('themes/slug')) .to_return(status: 200, body: { slug: { t: 'aa' } }.to_json) expect(api.theme_data('slug')).to eql('t' => 'aa') end end context 'when the slug does not exist' do it 'returns an empty hash' do stub_request(:get, api.uri.join('themes/slug-404')).to_return(status: 404, body: '{}') expect(api.theme_data('slug-404')).to eql({}) end end context 'when API limit reached' do it 'returns an empty hash' do stub_request(:get, api.uri.join('themes/slug-429')) .to_return(status: 429, body: { status: 'rate limit hit' }.to_json) expect(api.theme_data('slug-429')).to eql({}) end end end end describe '#wordpress_data' do before { api.token = api_token } context 'when no --api-token' do let(:api_token) { nil } it 'returns an empty hash' do expect(api.wordpress_data('1.2')).to eql({}) end end context 'when valid --api-token' do let(:api_token) { 's3cRet' } context 'when the version exist' do it 'calls the correct URL' do stub_request(:get, api.uri.join('wordpresses/522')) .to_return(status: 200, body: { '5.2.2' => { w: 'aa' } }.to_json) expect(api.wordpress_data('5.2.2')).to eql('w' => 'aa') end end context 'when the version does not exist' do it 'returns an empty hash' do stub_request(:get, api.uri.join('wordpresses/11')).to_return(status: 404, body: '{}') expect(api.wordpress_data('1.1')).to eql({}) end end context 'when API limit reached' do it 'returns an empty hash' do stub_request(:get, api.uri.join('wordpresses/429')) .to_return(status: 429, body: { status: 'rate limit hit' }.to_json) expect(api.wordpress_data('4.2.9')).to eql({}) end end end end describe '#status' do before do api.token = 's3cRet' stub_request(:get, api.uri.join('status')) .with(query: { version: WPScan::VERSION }, headers: request_headers) .to_return(status: code, body: return_body.to_json) end let(:code) { 200 } let(:return_body) { {} } context 'when 200' do let(:return_body) { { success: true, plan: 'free', requests_remaining: 100 } } it 'returns the expected hash' do status = api.status expect(status['success']).to be true expect(status['plan']).to eql 'free' expect(status['requests_remaining']).to eql 100 end context 'when unlimited requests' do let(:return_body) { super().merge(plan: 'enterprise', requests_remaining: -1) } it 'returns the expected hash, witht he correct requests_remaining' do status = api.status expect(status['success']).to be true expect(status['plan']).to eql 'enterprise' expect(status['requests_remaining']).to eql 'Unlimited' end end context 'when CF-Connecting-IP provided in CLI' do let(:return_body) { { success: true, plan: 'free', requests_remaining: 100 } } before do WPScan::Browser.instance.headers = { 'CF-Connecting-IP' => '123.123.123.123' } end it 'does not contain the CF-Connecting-IP header in the request' do status = api.status expect(status['success']).to be true expect(status['plan']).to eql 'free' expect(status['requests_remaining']).to eql 100 end end end # When invalid/empty API token context 'when 403' do let(:code) { 403 } let(:return_body) { { status: 'forbidden' } } it 'returns the expected hash' do expect(api.status['status']).to eql 'forbidden' end end context 'otherwise' do let(:code) { 0 } it 'returns the expected hash with the response as an exception' do status = api.status expect(status['http_error']).to be_a WPScan::Error::HTTP end end end end
Ruby
wpscan/spec/lib/db/wp_items_spec.rb
# frozen_string_literal: true describe WPScan::DB::WpItems do # Handled in plugins_spec & themes_spec end
Ruby
wpscan/spec/lib/db/wp_item_spec.rb
# frozen_string_literal: true describe WPScan::DB::WpItem do describe '#vulnerabilities' do # Handled in spec/app/models/plugin_spec end end
Ruby
wpscan/spec/lib/db/wp_version_spec.rb
# frozen_string_literal: true describe WPScan::DB::Version do describe '#vulnerabilities' do # Handled in spec/app/models/wp_version_spec end end
Ruby
wpscan/spec/lib/db/dynamic_finders/base_spec.rb
# frozen_string_literal: true describe WPScan::DB::DynamicFinders::Base do subject(:dynamic_finders) { described_class } # Handled in spec/lib/db/dynamic_finders/plugin and wordpress end
Ruby
wpscan/spec/lib/db/dynamic_finders/plugin_spec.rb
# frozen_string_literal: true describe WPScan::DB::DynamicFinders::Plugin do subject(:dynamic_finders) { described_class } describe '.finders_configs' do context 'when the given class is not allowed' do it 'returns an empty hash' do expect(subject.finder_configs('aaaa')).to eql({}) end end context 'when the given class is allowed' do context 'when aggressive argument is false' do it 'returns only the configs w/o a path parameter' do configs = subject.finder_configs(:Xpath) expect(configs.keys).to include('wordpress-mobile-pack', 'shareaholic') expect(configs.keys).to_not include('simple-share-button-adder') expect(configs['sitepress-multilingual-cms']['MetaGenerator']['pattern']).to be_a Regexp expect(configs['sitepress-multilingual-cms']['MetaGenerator']['version']).to eql true end end context 'when aggressive argument is true' do it 'returns only the configs with a path parameter' do configs = subject.finder_configs(:Xpath, aggressive: true) expect(configs.keys).to include('revslider') expect(configs.keys).to_not include('shareaholic') end end end end describe '.versions_finders_configs' do # Just test a sample here its('versions_finders_configs.keys') { should include('shareaholic') } its('versions_finders_configs.keys') { should_not include('wordpress-mobile-pack') } end describe '.maybe_create_module' do xit end describe '.create_versions_finders' do # handled and tested in spec/lib/finders/dynamic_finders/plugin_version_spec context 'When trying to create the finders twice' do # let's just test one slug, no need to test them all let(:slug) { '12-step-meeting-list' } it 'does not raise an error when the class already exists' do WPScan::DB::DynamicFinders::Plugin.create_versions_finders(slug) expect { WPScan::DB::DynamicFinders::Plugin.create_versions_finders(slug) }.to_not raise_error end end context 'when the slug contains non alpha-numeric chars' do let(:slug) { 'test.something' } it 'sanitize it and does not raise an error' do expect { WPScan::DB::DynamicFinders::Plugin.create_versions_finders(slug) }.to_not raise_error end end end describe '.version_finder_super_class' do # handled and tested in spec/lib/finders/dynamic_finders/plugin_version_spec end describe '.method_missing' do context 'when the method matches a valid call' do its('passive_comment_finder_configs.keys') { should include('addthis') } its('passive_comment_finder_configs.keys') { should_not include('shareaholic') } its('passive_xpath_finder_configs.keys') { should include('shareaholic') } its('passive_xpath_finder_configs.keys') { should_not include('simple-share-button-adder') } its('aggressive_xpath_finder_configs.keys') { should_not include('wordpress-mobile-pack') } its('aggressive_xpath_finder_configs.keys') { should include('revslider') } end context 'when the method does not match a valid call' do it 'raises an error' do expect { subject.aaa }.to raise_error(NoMethodError) end end end end
Ruby
wpscan/spec/lib/db/dynamic_finders/theme_spec.rb
# frozen_string_literal: true describe WPScan::DB::DynamicFinders::Theme do subject(:dynamic_finders) { described_class } # Most of it is done in the Plugin specs xit end
Ruby
wpscan/spec/lib/db/dynamic_finders/wordpress_spec.rb
# frozen_string_literal: true describe WPScan::DB::DynamicFinders::Wordpress do subject(:dynamic_finders) { described_class } xit end
Ruby
wpscan/spec/lib/finders/dynamic_finder/plugin_version_spec.rb
# frozen_string_literal: true # All Plugin Dynamic Finders returning a Version are tested here. # When adding one to the spec/fixtures/db/dynamic_finder.yml, a few files have # to be edited/created # # - spec/fixtures/dynamic_finder/expected.yml with the expected result/s # - Then, depending on the finder class used: spec/fixtures/dynamic_finder/plugin_version/ # # Furthermore, the fixtures files _passive_all.html are also used by plugins/themes # finders in spec/app/finders/plugins|themes to check the items existence from the homepage # # In case of a failure, it's recommended to use rspec -e "<Full Description>" while fixing. # e.g: rspec -e "WPScan::Finders::PluginVersion::Cardealerpress::HeaderPattern#passive" # The -e option can also be used to test all HeaderPattern, for example: rspec -e "::HeaderPattern" expected_all = df_expected_all['plugins'] WPScan::DB::DynamicFinders::Plugin.versions_finders_configs.each do |slug, configs| WPScan::DB::DynamicFinders::Plugin.create_versions_finders(slug) configs.each do |finder_class, config| finder_super_class = config['class'] || finder_class # The QueryParameter specs are slow given the huge fixture file # If someone find a fix for that, please share! describe df_tested_class_constant('PluginVersion', finder_class, slug), slow: true do subject(:finder) { described_class.new(plugin) } let(:plugin) { WPScan::Model::Plugin.new(slug, target) } let(:target) { WPScan::Target.new('http://wp.lab/') } let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('plugin_version') } let(:expected) do if expected_all[slug][finder_class].is_a?(Hash) [expected_all[slug][finder_class]] else expected_all[slug][finder_class] end end before { allow(target).to receive(:content_dir).and_return('wp-content') } describe '#passive', slow: true do before do if defined?(stubbed_homepage_res) stub_request(:get, target.url).to_return(stubbed_homepage_res) else stub_request(:get, target.url) end if defined?(stubbed_404_res) stub_request(:get, ERROR_404_URL_PATTERN).to_return(stubbed_404_res) else stub_request(:get, ERROR_404_URL_PATTERN) end end if config['path'] context 'when PATH' do it 'returns nil' do expect(finder.passive).to eql nil end end else context 'when no PATH' do context 'when the version is detected' do context 'from the homepage' do let(:ie_url) { target.url } let(:stubbed_homepage_res) do df_stubbed_response( fixtures.join("#{finder_super_class.underscore}_passive_all.html"), finder_super_class ) end it 'returns the expected version/s' do found = Array(finder.passive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_ie expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end context 'from the 404' do let(:ie_url) { target.error_404_url } let(:stubbed_404_res) do df_stubbed_response( fixtures.join("#{finder_super_class.underscore}_passive_all.html"), finder_super_class ) end it 'returns the expected version/s' do found = Array(finder.passive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_ie expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end end context 'when the version is not detected' do it 'returns nil or an empty array' do expect(finder.passive).to eql finder_super_class == 'QueryParameter' ? [] : nil end end end end end describe '#aggressive' do let(:fixtures) { super().join(slug, finder_class.underscore) } let(:stubbed_response) { { body: 'aa' } } before do stub_request(:get, plugin.url(config['path'])).to_return(stubbed_response) if config['path'] end if config['path'] context 'when the version is detected' do let(:stubbed_response) do df_stubbed_response(fixtures.join(config['path']), finder_super_class) end it 'returns the expected version' do found = Array(finder.aggressive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expect(version).to be_a WPScan::Model::Version expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_version['interesting_entries'] expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end context 'when the version is not detected' do it 'returns nil or an empty array' do expect(finder.aggressive).to eql finder_super_class == 'QueryParameter' ? [] : nil end end else it 'returns nil' do expect(finder.aggressive).to eql nil end end end end end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/theme_version_spec.rb
# frozen_string_literal: true # All Theme Dynamic Finders returning a Version are tested here. # When adding one to the spec/fixtures/db/dynamic_finder.yml, a few files have # to be edited/created # # - spec/fixtures/dynamic_finder/expected.yml with the expected result/s # - Then, depending on the finder class used: spec/fixtures/dynamic_finder/theme_version/ # # Furthermore, the fixtures files _passive_all.html are also used by plugins/themes # finders in spec/app/finders/plugins|themes to check the items existence from the homepage # # In case of a failure, it's recommended to use rspec -e "<Full Description>" while fixing. # e.g: rspec -e "WPScan::Finders::ThemeVersion::Cardealerpress::HeaderPattern#passive" # The -e option can also be used to test all HeaderPattern, for example: rspec -e "::HeaderPattern" expected_all = df_expected_all['themes'] WPScan::DB::DynamicFinders::Theme.versions_finders_configs.each do |slug, configs| WPScan::DB::DynamicFinders::Theme.create_versions_finders(slug) configs.each do |finder_class, config| finder_super_class = config['class'] || finder_class # The QueryParameter specs are slow given the huge fixture file # If someone find a fix for that, please share! describe df_tested_class_constant('ThemeVersion', finder_class, slug), slow: true do subject(:finder) { described_class.new(theme) } let(:theme) { WPScan::Model::Theme.new(slug, target) } let(:target) { WPScan::Target.new('http://wp.lab/') } let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('theme_version') } let(:expected) do if expected_all[slug][finder_class].is_a?(Hash) [expected_all[slug][finder_class]] else expected_all[slug][finder_class] end end before do allow(target).to receive(:content_dir).and_return('wp-content') # When creating a theme, the style.css is checked, let's stub that stub_request(:get, target.url("wp-content/themes/#{slug}/style.css")) end describe '#passive', slow: true do before do if defined?(stubbed_homepage_res) stub_request(:get, target.url).to_return(stubbed_homepage_res) else stub_request(:get, target.url) end if defined?(stubbed_404_res) stub_request(:get, ERROR_404_URL_PATTERN).to_return(stubbed_404_res) else stub_request(:get, ERROR_404_URL_PATTERN) end end if config['path'] context 'when PATH' do it 'returns nil' do expect(finder.passive).to eql nil end end else context 'when no PATH' do context 'when the version is detected' do context 'from the homepage' do let(:ie_url) { target.url } let(:stubbed_homepage_res) do df_stubbed_response( fixtures.join("#{finder_super_class.underscore}_passive_all.html"), finder_super_class ) end it 'returns the expected version/s' do found = Array(finder.passive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_ie expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end context 'from the 404' do let(:ie_url) { target.error_404_url } let(:stubbed_404_res) do df_stubbed_response( fixtures.join("#{finder_super_class.underscore}_passive_all.html"), finder_super_class ) end it 'returns the expected version/s' do found = Array(finder.passive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expected_ie = expected_version['interesting_entries'].map do |ie| ie.gsub("#{target.url},", "#{ie_url},") end expect(version).to be_a WPScan::Model::Version expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_ie expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end end context 'when the version is not detected' do it 'returns nil or an empty array' do expect(finder.passive).to eql finder_super_class == 'QueryParameter' ? [] : nil end end end end end describe '#aggressive' do let(:fixtures) { super().join(slug, finder_class.underscore) } let(:stubbed_response) { { body: 'aa' } } before do stub_request(:get, theme.url(config['path'])).to_return(stubbed_response) if config['path'] end if config['path'] context 'when the version is detected' do let(:stubbed_response) do df_stubbed_response(fixtures.join(config['path']), finder_super_class) end it 'returns the expected version' do found = Array(finder.aggressive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expect(version).to be_a WPScan::Model::Version expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_version['interesting_entries'] expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end context 'when the version is not detected' do it 'returns nil or an empty array' do expect(finder.aggressive).to eql finder_super_class == 'QueryParameter' ? [] : nil end end else it 'returns nil' do expect(finder.aggressive).to eql nil end end end end end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/wp_version_spec.rb
# frozen_string_literal: true expected_all = df_expected_all['wordpress'] WPScan::DB::DynamicFinders::Wordpress.create_versions_finders describe 'Try to create the finders twice' do it 'does not raise an error when the class already exists' do expect { WPScan::DB::DynamicFinders::Wordpress.create_versions_finders }.to_not raise_error end end WPScan::DB::DynamicFinders::Wordpress.versions_finders_configs.each do |finder_class, config| finder_super_class = config['class'] || finder_class describe df_tested_class_constant('WpVersion', finder_class) do subject(:finder) { described_class.new(target) } let(:target) { WPScan::Target.new('http://wp.lab/') } let(:fixtures) { DYNAMIC_FINDERS_FIXTURES.join('wp_version') } let(:expected) do expected_all[finder_class].is_a?(Hash) ? [expected_all[finder_class]] : expected_all[finder_class] end let(:stubbed_response) { { body: '' } } describe '#passive' do before do stub_request(:get, target.url).to_return(stubbed_response) stub_request(:get, ERROR_404_URL_PATTERN) end if config['path'] context 'when PATH' do it 'returns nil' do expect(finder.passive).to eql nil end end else context 'when no PATH' do let(:stubbed_response) do df_stubbed_response( fixtures.join("#{finder_super_class.underscore}_passive_all.html"), finder_super_class ) end it 'returns the expected version from the homepage' do found = Array(finder.passive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expect(version).to be_a WPScan::Model::WpVersion expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_version['interesting_entries'] expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end end end describe '#aggressive' do let(:fixtures) { super().join(finder_class.underscore) } before do allow(target).to receive(:sub_dir).and_return(false) stub_request(:get, target.url(config['path'])).to_return(stubbed_response) if config['path'] end if config['path'] context 'when the version is detected' do let(:stubbed_response) do df_stubbed_response(fixtures.join(config['path']), finder_super_class) end it 'returns the expected version' do found = Array(finder.aggressive) expect(found).to_not be_empty found.each_with_index do |version, index| expected_version = expected.at(index) expect(version).to be_a WPScan::Model::WpVersion expect(version.number).to eql expected_version['number'].to_s expect(version.found_by).to eql expected_version['found_by'] expect(version.interesting_entries).to match_array expected_version['interesting_entries'] expect(version.confidence).to eql expected_version['confidence'] if expected_version['confidence'] end end end context 'when the version is not detected' do it 'returns nil or an empty array' do expect(finder.aggressive).to eql finder_super_class == 'QueryParameter' ? [] : nil end end else it 'returns nil' do expect(finder.aggressive).to eql nil end end end end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/version/body_pattern_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::Version::BodyPattern do module WPScan module Finders module Version # Needed to be able to test the below module Rspec end end end end let(:finder_module) { WPScan::Finders::Version::Rspec } let(:finder_class) { WPScan::Finders::Version::Rspec::BodyPattern } let(:finder_config) { { 'pattern' => /aaa/i } } let(:default) { { 'confidence' => 60 } } before { described_class.create_child_class(finder_module, :BodyPattern, finder_config) } after { finder_module.send(:remove_const, :BodyPattern) } describe '.create_child_class' do context 'when no PATH and CONFIDENCE' do it 'contains the expected constants to their default values' do # Doesn't work, dunno why # expect(finder_module.const_get(:BodyPattern)).to be_a described_class # expect(finder_class.is_a?(described_class)).to eql true # expect(finder_class).to be_a described_class expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::CONFIDENCE).to eql default['confidence'] expect(finder_class::PATH).to eql nil end end context 'when CONFIDENCE' do let(:finder_config) { super().merge('confidence' => 50) } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::CONFIDENCE).to eql finder_config['confidence'] expect(finder_class::PATH).to eql nil end end context 'when PATH' do let(:finder_config) { super().merge('path' => 'changelog.txt') } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::CONFIDENCE).to eql default['confidence'] end end end describe '#passive, #aggressive' do # Handled in spec/lib/finders/dynamic_finder/plugin_version_spec end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/version/comment_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::Version::Comment do module WPScan module Finders module Version # Needed to be able to test the below module Rspec end end end end let(:finder_module) { WPScan::Finders::Version::Rspec } let(:finder_class) { WPScan::Finders::Version::Rspec::Comment } let(:finder_config) { { 'pattern' => /some version: (?<v>[\d.]+)/i } } let(:default) { { 'xpath' => '//comment()', 'confidence' => 60 } } before { described_class.create_child_class(finder_module, :Comment, finder_config) } after { finder_module.send(:remove_const, :Comment) } describe '.create_child_class' do context 'when no PATH and CONFIDENCE' do it 'contains the expected constants to their default values' do # Doesn't work, dunno why # expect(finder_module.const_get(:Comment)).to be_a described_class # expect(finder_class.is_a?(described_class)).to eql true # expect(finder_class).to be_a described_class expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::XPATH).to eql default['xpath'] expect(finder_class::CONFIDENCE).to eql default['confidence'] expect(finder_class::PATH).to eql nil end end context 'when CONFIDENCE' do let(:finder_config) { super().merge('confidence' => 30) } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::CONFIDENCE).to eql finder_config['confidence'] expect(finder_class::XPATH).to eql default['xpath'] expect(finder_class::PATH).to eql nil end end context 'when PATH' do let(:finder_config) { super().merge('path' => 'file.txt') } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::CONFIDENCE).to eql default['confidence'] expect(finder_class::XPATH).to eql default['xpath'] end end context 'when XPATH' do let(:finder_config) { super().merge('xpath' => '//comment()[contains(. "aa")]') } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::XPATH).to eql finder_config['xpath'] expect(finder_class::PATH).to eql nil expect(finder_class::CONFIDENCE).to eql default['confidence'] end end end describe '#passive, #aggressive' do # Handled in spec/lib/finders/dynamic_finder/plugin_version_spec end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/version/config_parser_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::Version::ConfigParser do module WPScan module Finders module Version # Needed to be able to test the below module Rspec end end end end let(:finder_module) { WPScan::Finders::Version::Rspec } let(:finder_class) { WPScan::Finders::Version::Rspec::ConfigParser } let(:finder_config) { { 'key' => 'some-key', 'path' => 'file.json' } } let(:default) { { 'pattern' => /(?<v>\d+\.[.\d]+)/, 'confidence' => 70 } } before { described_class.create_child_class(finder_module, :ConfigParser, finder_config) } after { finder_module.send(:remove_const, :ConfigParser) } describe '.create_child_class' do context 'when CONFIDENCE' do let(:finder_config) { super().merge('confidence' => 30) } it 'contains the expected constants' do expect(finder_class::KEY).to eql finder_config['key'] expect(finder_class::CONFIDENCE).to eql finder_config['confidence'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::PATTERN).to eql default['pattern'] end end context 'when PATTERN' do let(:finder_config) { super().merge('pattern' => /another pattern/i) } it 'contains the expected constants' do expect(finder_class::KEY).to eql finder_config['key'] expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::CONFIDENCE).to eql default['confidence'] end end end describe '#passive, #aggressive' do # Handled in spec/lib/finders/dynamic_finder/plugin_version_spec end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/version/header_pattern_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::Version::HeaderPattern do module WPScan module Finders module Version # Needed to be able to test the below module Rspec end end end end let(:finder_module) { WPScan::Finders::Version::Rspec } let(:finder_class) { WPScan::Finders::Version::Rspec::HeaderPattern } let(:finder_config) { { 'header' => 'Location' } } let(:default) { { 'confidence' => 60 } } before { described_class.create_child_class(finder_module, :HeaderPattern, finder_config) } after { finder_module.send(:remove_const, :HeaderPattern) } describe '.create_child_class' do context 'when no PATH and CONFIDENCE' do it 'contains the expected constants to their default values' do # Doesn't work, dunno why # expect(finder_module.const_get(:HeaderPattern)).to be_a described_class # expect(finder_class.is_a?(described_class)).to eql true # expect(finder_class).to be_a described_class expect(finder_class::HEADER).to eql finder_config['header'] expect(finder_class::PATTERN).to eql nil expect(finder_class::CONFIDENCE).to eql default['confidence'] expect(finder_class::PATH).to eql nil end end context 'when CONFIDENCE' do let(:finder_config) { super().merge('confidence' => 50) } it 'contains the expected constants' do expect(finder_class::HEADER).to eql finder_config['header'] expect(finder_class::CONFIDENCE).to eql finder_config['confidence'] expect(finder_class::PATTERN).to eql nil expect(finder_class::PATH).to eql nil end end context 'when PATH' do let(:finder_config) { super().merge('path' => 'index.php') } it 'contains the expected constants' do expect(finder_class::HEADER).to eql finder_config['header'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::PATTERN).to eql nil expect(finder_class::CONFIDENCE).to eql default['confidence'] end end context 'when PATTERN' do let(:finder_config) { super().merge('pattern' => /Version: (?<v>[\d.]+)/i) } it 'contains the expected constants' do expect(finder_class::HEADER).to eql finder_config['header'] expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::PATH).to eql nil expect(finder_class::CONFIDENCE).to eql default['confidence'] end end end describe '#passive, #aggressive' do # Handled in spec/lib/finders/dynamic_finder/plugin_version_spec end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/version/javascript_var_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::Version::JavascriptVar do module WPScan module Finders module Version # Needed to be able to test the below module Rspec end end end end let(:finder_module) { WPScan::Finders::Version::Rspec } let(:finder_class) { WPScan::Finders::Version::Rspec::JavascriptVar } let(:finder_config) { { 'pattern' => /some version: (?<v>[\d.]+)/i } } let(:default) { { 'xpath' => '//script[not(@src)]', 'confidence' => 60 } } before { described_class.create_child_class(finder_module, :JavascriptVar, finder_config) } after { finder_module.send(:remove_const, :JavascriptVar) } describe '.create_child_class' do context 'when no PATH and CONFIDENCE' do it 'contains the expected constants to their default values' do # Doesn't work, dunno why # expect(finder_module.const_get(:JavascriptVar)).to be_a described_class # expect(finder_class.is_a?(described_class)).to eql true # expect(finder_class).to be_a described_class expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::XPATH).to eql default['xpath'] expect(finder_class::CONFIDENCE).to eql default['confidence'] expect(finder_class::PATH).to eql nil end end context 'when CONFIDENCE' do let(:finder_config) { super().merge('confidence' => 30) } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::CONFIDENCE).to eql finder_config['confidence'] expect(finder_class::XPATH).to eql default['xpath'] expect(finder_class::PATH).to eql nil end end context 'when PATH' do let(:finder_config) { super().merge('path' => 'file.html') } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::CONFIDENCE).to eql default['confidence'] expect(finder_class::XPATH).to eql default['xpath'] end end context 'when XPATH' do let(:finder_config) { super().merge('xpath' => '//script') } it 'contains the expected constants' do expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::XPATH).to eql finder_config['xpath'] expect(finder_class::PATH).to eql nil expect(finder_class::CONFIDENCE).to eql default['confidence'] end end end describe '#passive, #aggressive' do # Handled in spec/lib/finders/dynamic_finder/plugin_version_spec end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/version/query_parameter_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::Version::QueryParameter do module WPScan module Finders module Version # Needed to be able to test the below module Rspec end end end end let(:finder_module) { WPScan::Finders::Version::Rspec } let(:finder_class) { WPScan::Finders::Version::Rspec::QueryParameter } let(:finder_config) { { 'files' => %w[f1 f2] } } let(:default) { { 'pattern' => /(?:v|ver|version)=(?<v>\d+\.[.\d]+)/i, 'confidence_per_occurence' => 10 } } before { described_class.create_child_class(finder_module, :QueryParameter, finder_config) } after { finder_module.send(:remove_const, :QueryParameter) } describe '.create_child_class' do context 'when no XPATH, PATTERN and CONFIDENCE_PER_OCCURENCE ' do it 'contains the expected constants to their default values' do expect(finder_class::FILES).to eql finder_config['files'] expect(finder_class::PATTERN).to eql default['pattern'] expect(finder_class::CONFIDENCE_PER_OCCURENCE).to eql default['confidence_per_occurence'] expect(finder_class::XPATH).to eql nil expect(finder_class::PATH).to eql nil end end context 'when XPATH' do let(:finder_config) { super().merge('xpath' => '//xpath') } it 'contains the expected constants' do expect(finder_class::FILES).to eql finder_config['files'] expect(finder_class::XPATH).to eql finder_config['xpath'] expect(finder_class::CONFIDENCE_PER_OCCURENCE).to eql default['confidence_per_occurence'] expect(finder_class::PATTERN).to eql default['pattern'] expect(finder_class::PATH).to eql nil end end context 'when PATTERN' do let(:finder_config) { super().merge('pattern' => /pattern/i) } it 'contains the expected constants' do expect(finder_class::FILES).to eql finder_config['files'] expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::CONFIDENCE_PER_OCCURENCE).to eql default['confidence_per_occurence'] expect(finder_class::XPATH).to eql nil expect(finder_class::PATH).to eql nil end end context 'when CONFIDENCE_PER_OCCURENCE' do let(:finder_config) { super().merge('confidence_per_occurence' => 30) } it 'contains the expected constants' do expect(finder_class::FILES).to eql finder_config['files'] expect(finder_class::CONFIDENCE_PER_OCCURENCE).to eql finder_config['confidence_per_occurence'] expect(finder_class::PATTERN).to eql default['pattern'] expect(finder_class::XPATH).to eql nil expect(finder_class::PATH).to eql nil end end context 'when PATH' do let(:finder_config) { super().merge('path' => 'file.html') } it 'contains the expected constants' do expect(finder_class::FILES).to eql finder_config['files'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::CONFIDENCE_PER_OCCURENCE).to eql default['confidence_per_occurence'] expect(finder_class::XPATH).to eql nil expect(finder_class::PATTERN).to eql default['pattern'] end end end describe '#passive, #aggressive' do # Handled in spec/lib/finders/dynamic_finder/plugin_version_spec end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/version/xpath_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::Version::Xpath do module WPScan module Finders module Version # Needed to be able to test the below module Rspec end end end end let(:finder_module) { WPScan::Finders::Version::Rspec } let(:finder_class) { WPScan::Finders::Version::Rspec::Xpath } let(:finder_config) { { 'xpath' => "//div/h3[@class='version-number']" } } let(:default) { { 'pattern' => /\A(?<v>\d+\.[.\d]+)/, 'confidence' => 60 } } before { described_class.create_child_class(finder_module, :Xpath, finder_config) } after { finder_module.send(:remove_const, :Xpath) } describe '.create_child_class' do context 'when no PATH and CONFIDENCE' do it 'contains the expected constants to their default values' do # Doesn't work, dunno why # expect(finder_module.const_get(:Xpath)).to be_a described_class # expect(finder_class.is_a?(described_class)).to eql true # expect(finder_class).to be_a described_class expect(finder_class::XPATH).to eql finder_config['xpath'] expect(finder_class::PATTERN).to eql default['pattern'] expect(finder_class::CONFIDENCE).to eql default['confidence'] expect(finder_class::PATH).to eql nil end end context 'when CONFIDENCE' do let(:finder_config) { super().merge('confidence' => 30) } it 'contains the expected constants' do expect(finder_class::XPATH).to eql finder_config['xpath'] expect(finder_class::CONFIDENCE).to eql finder_config['confidence'] expect(finder_class::PATTERN).to eql default['pattern'] expect(finder_class::PATH).to eql nil end end context 'when PATH' do let(:finder_config) { super().merge('path' => 'file.txt') } it 'contains the expected constants' do expect(finder_class::XPATH).to eql finder_config['xpath'] expect(finder_class::PATH).to eql finder_config['path'] expect(finder_class::PATTERN).to eql default['pattern'] expect(finder_class::CONFIDENCE).to eql default['confidence'] end end context 'when PATTERN' do let(:finder_config) { super().merge('pattern' => /Version: (?<v>[\d.]+)/i) } it 'contains the expected constants' do expect(finder_class::XPATH).to eql finder_config['xpath'] expect(finder_class::PATTERN).to eql finder_config['pattern'] expect(finder_class::PATH).to eql nil expect(finder_class::CONFIDENCE).to eql default['confidence'] end end end describe '#passive, #aggressive' do # Handled in spec/lib/finders/dynamic_finder/plugin_version_spec end end
Ruby
wpscan/spec/lib/finders/dynamic_finder/wp_items/finder_spec.rb
# frozen_string_literal: true describe WPScan::Finders::DynamicFinder::WpItems::Finder do # Handled in spec/shared_examples/dynamic_finders/wp_items.rb end
Ruby
wpscan/spec/lib/finders/finder/wp_version/smart_url_checker_spec.rb
# frozen_string_literal: true describe WPScan::Finders::Finder::WpVersion::SmartURLChecker do xit end
Ruby
wpscan/spec/lib/typhoeus/response_spec.rb
# frozen_string_literal: true describe Typhoeus::Response do describe '#from_vuln_api?' do context 'when a response from the Vuln API' do %w[ https://wpscan.com/api/v3/plugins/wpscan https://wpscan.com/api/v3/plugins/status-test https://wpscan.com/api/v3/themes/test https://wpscan.com/api/v3/plugins/test/v3/status ].each do |response_url| it "returnse false for #{response_url}" do expect(described_class.new(return_code: 200, effective_url: response_url).from_vuln_api?).to be true end end end context 'when not a response from the Vuln API (/status endpoint is ignored)' do %w[ https://wpscan.com/something http://wp.lab/ https://wp.lab/status https://wpscan.com/api/v3/status ].each do |response_url| it "returns false for #{response_url}" do expect(described_class.new(return_code: 200, effective_url: response_url).from_vuln_api?).to be false end end end end end
wpscan/spec/output/enumeration/medias/medias.cli_no_colour
[i] Medias(s) Identified: [+] http://ex.lo/?attachment_id=1 | Found By: Attachment Brute Forcing [+] http://ex.lo/?attachment_id=5 | Found By: Attachment Brute Forcing
JSON
wpscan/spec/output/enumeration/medias/medias.json
{ "medias": { "http://ex.lo/?attachment_id=1": { "found_by": "Attachment Brute Forcing", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { } }, "http://ex.lo/?attachment_id=5": { "found_by": "Attachment Brute Forcing", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { } } } }
wpscan/spec/output/enumeration/timthumbs/no_vulns.cli_no_colour
[i] Timthumb(s) Identified: [+] http://ex.lo/tt.php | Found By: Known Locations | | Version: 2.8.14 | Found By: Bad Request [+] http://ex.lo/tt2.php | Found By: Known Locations | | Version: 2.8.14 | Found By: Bad Request
JSON
wpscan/spec/output/enumeration/timthumbs/no_vulns.json
{ "timthumbs": { "http://ex.lo/tt.php": { "found_by": "Known Locations", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ ], "version": { "number": "2.8.14", "confidence": 0, "found_by": "Bad Request", "interesting_entries": [ ], "confirmed_by": { } } }, "http://ex.lo/tt2.php": { "found_by": "Known Locations", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ ], "version": { "number": "2.8.14", "confidence": 0, "found_by": "Bad Request", "interesting_entries": [ ], "confirmed_by": { } } } } }
wpscan/spec/output/enumeration/timthumbs/with_vulns.cli_no_colour
[i] Timthumb(s) Identified: [+] http://ex.lo/tt.php | Found By: Known Locations | | [!] 2 vulnerabilities identified: | | [!] Title: Timthumb <= 2.8.13 WebShot Remote Code Execution | Fixed in: 2.8.14 | References: | - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-4663 | - http://seclists.org/fulldisclosure/2014/Jun/117 | - https://github.com/wpscanteam/wpscan/issues/519 | | [!] Title: Timthumb <= 1.32 Remote Code Execution | Fixed in: 1.33 | Reference: https://www.exploit-db.com/exploits/17602/ | | The version could not be determined. [+] http://ex.lo/tt2.php | Found By: Known Locations | | Version: 2.8.14 | Found By: Bad Request
JSON
wpscan/spec/output/enumeration/timthumbs/with_vulns.json
{ "timthumbs": { "http://ex.lo/tt.php": { "found_by": "Known Locations", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ { "title": "Timthumb <= 2.8.13 WebShot Remote Code Execution", "fixed_in": "2.8.14", "references": { "cve": [ "2014-4663" ], "url": [ "http://seclists.org/fulldisclosure/2014/Jun/117", "https://github.com/wpscanteam/wpscan/issues/519" ] } }, { "title": "Timthumb <= 1.32 Remote Code Execution", "fixed_in": "1.33", "references": { "exploitdb": [ "17602" ] } } ], "version": null }, "http://ex.lo/tt2.php": { "found_by": "Known Locations", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ ], "version": { "number": "2.8.14", "confidence": 0, "found_by": "Bad Request", "interesting_entries": [ ], "confirmed_by": { } } } } }
wpscan/spec/output/main_theme/no_verbose.cli_no_colour
[+] WordPress theme in use: test | Location: http://ex.lo/wp-content/themes/test/ | Readme: http://ex.lo/wp-content/themes/test/readme.txt | Style URL: http://ex.lo/wp-content/themes/test/style.css | Style Name: Twenty Fifteen | Style URI: https://wordpress.org/themes/twentyfifteen | Description: Our 2015 default theme is clean, blog-focused.... | Author: the WordPress team | | Found By: rspec | | The version could not be determined.
JSON
wpscan/spec/output/main_theme/no_verbose.json
{ "main_theme": { "slug": "test", "location": "http://ex.lo/wp-content/themes/test/", "latest_version": null, "last_updated": null, "outdated": false, "readme_url": "http://ex.lo/wp-content/themes/test/readme.txt", "directory_listing": false, "error_log_url": null, "style_url": "http://ex.lo/wp-content/themes/test/style.css", "style_name": "Twenty Fifteen", "style_uri": "https://wordpress.org/themes/twentyfifteen", "description": "Our 2015 default theme is clean, blog-focused.", "author": "the WordPress team", "author_uri": null, "template": null, "license": "GNU General Public License v2 or later", "license_uri": "http://www.gnu.org/licenses/gpl-2.0.html", "tags": "black, blue, gray, pink, purple, white, yellow.", "text_domain": "twentyfifteen", "found_by": "rspec", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ ], "version": null, "parents": [ ] } }
wpscan/spec/output/main_theme/verbose.cli_no_colour
[+] WordPress theme in use: test | Location: http://ex.lo/wp-content/themes/test/ | Readme: http://ex.lo/wp-content/themes/test/readme.txt | Style URL: http://ex.lo/wp-content/themes/test/style.css | Style Name: Twenty Fifteen | Style URI: https://wordpress.org/themes/twentyfifteen | Description: Our 2015 default theme is clean, blog-focused. | Author: the WordPress team | License: GNU General Public License v2 or later | License URI: http://www.gnu.org/licenses/gpl-2.0.html | Tags: black, blue, gray, pink, purple, white, yellow. | Text Domain: twentyfifteen | | Found By: rspec | | Version: 3.2 (0% confidence) | Found By: style
JSON
wpscan/spec/output/main_theme/verbose.json
{ "main_theme": { "slug": "test", "location": "http://ex.lo/wp-content/themes/test/", "latest_version": null, "last_updated": null, "outdated": false, "readme_url": "http://ex.lo/wp-content/themes/test/readme.txt", "directory_listing": false, "error_log_url": null, "style_url": "http://ex.lo/wp-content/themes/test/style.css", "style_name": "Twenty Fifteen", "style_uri": "https://wordpress.org/themes/twentyfifteen", "description": "Our 2015 default theme is clean, blog-focused.", "author": "the WordPress team", "author_uri": null, "template": null, "license": "GNU General Public License v2 or later", "license_uri": "http://www.gnu.org/licenses/gpl-2.0.html", "tags": "black, blue, gray, pink, purple, white, yellow.", "text_domain": "twentyfifteen", "found_by": "rspec", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ ], "version": { "number": "3.2", "confidence": 0, "found_by": "style", "interesting_entries": [ ], "confirmed_by": { } }, "parents": [ ] } }
wpscan/spec/output/main_theme/vulnerable.cli_no_colour
[+] WordPress theme in use: dignitas-themes | Location: http://ex.lo/wp-content/themes/dignitas-themes/ | Readme: http://ex.lo/wp-content/themes/dignitas-themes/readme.txt | Style URL: http://ex.lo/wp-content/themes/dignitas-themes/style.css | Style Name: Twenty Fifteen | Style URI: https://wordpress.org/themes/twentyfifteen | Description: Our 2015 default theme is clean, blog-focused. | Author: the WordPress team | License: GNU General Public License v2 or later | License URI: http://www.gnu.org/licenses/gpl-2.0.html | Tags: black, blue, gray, pink, purple, white, yellow. | Text Domain: twentyfifteen | | Found By: rspec | | [!] 1 vulnerability identified: | | [!] Title: Dignitas 1.1.9 - Privilage Escalation | References: | - https://wpscan.com/vulnerability/7825 | - http://research.evex.pw/?vuln=6 | - https://packetstormsecurity.com/files/130652/ | | The version could not be determined.
JSON
wpscan/spec/output/main_theme/vulnerable.json
{ "main_theme": { "slug": "dignitas-themes", "location": "http://ex.lo/wp-content/themes/dignitas-themes/", "latest_version": null, "last_updated": null, "outdated": false, "readme_url": "http://ex.lo/wp-content/themes/dignitas-themes/readme.txt", "directory_listing": false, "error_log_url": null, "style_url": "http://ex.lo/wp-content/themes/dignitas-themes/style.css", "style_name": "Twenty Fifteen", "style_uri": "https://wordpress.org/themes/twentyfifteen", "description": "Our 2015 default theme is clean, blog-focused.", "author": "the WordPress team", "author_uri": null, "template": null, "license": "GNU General Public License v2 or later", "license_uri": "http://www.gnu.org/licenses/gpl-2.0.html", "tags": "black, blue, gray, pink, purple, white, yellow.", "text_domain": "twentyfifteen", "found_by": "rspec", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ { "title": "Dignitas 1.1.9 - Privilage Escalation", "fixed_in": null, "references": { "url": [ "http://research.evex.pw/?vuln=6" ], "packetstorm": [ "130652" ], "wpvulndb": [ "7825" ] } } ], "version": null, "parents": [ ] } }
JSON
wpscan/spec/output/vuln_api/all_ok.json
{ "vuln_api": { "plan": "paid", "requests_done_during_scan": 3, "requests_remaining": 120 } }
JSON
wpscan/spec/output/vuln_api/no_more_requests.json
{ "vuln_api": { "plan": "free", "requests_done_during_scan": 3, "requests_remaining": 0 } }
wpscan/spec/output/vuln_api/no_token.cli_no_colour
[!] No WPScan API Token given, as a result vulnerability data has not been output. [!] You can get a free API token with 25 daily requests by registering at https://wpscan.com/register
JSON
wpscan/spec/output/vuln_api/no_token.json
{ "vuln_api": { "error": "No WPScan API Token given, as a result vulnerability data has not been output.\nYou can get a free API token with 25 daily requests by registering at https://wpscan.com/register" } }
wpscan/spec/output/vuln_api/unlimited_requests.cli_no_colour
[+] WPScan DB API OK | Plan: enterprise | Requests Done (during the scan): 3 | Requests Remaining: Unlimited
JSON
wpscan/spec/output/vuln_api/unlimited_requests.json
{ "vuln_api": { "plan": "enterprise", "requests_done_during_scan": 3, "requests_remaining": "Unlimited" } }
wpscan/spec/output/wp_version/confirmed_multiples.cli_no_colour
[+] WordPress version 4.0 identified (Latest, released on 2014-09-04). | Found By: rspec | Confirmed By: | Confirmed 1 | - IE1 | Confirmed 2 | - IE1 | - IE2
JSON
wpscan/spec/output/wp_version/confirmed_multiples.json
{ "version": { "number": "4.0", "release_date": "2014-09-04", "status": "latest", "found_by": "rspec", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { "Confirmed 1": { "confidence": 0, "interesting_entries": [ "IE1" ] }, "Confirmed 2": { "confidence": 0, "interesting_entries": [ "IE1", "IE2" ] } }, "vulnerabilities": [ ] } }
wpscan/spec/output/wp_version/confirmed_one.cli_no_colour
[+] WordPress version 4.0 identified (Latest, released on 2014-09-04). | Found By: rspec | Confirmed By: Confirmed 1 | - IE1
JSON
wpscan/spec/output/wp_version/confirmed_one.json
{ "version": { "number": "4.0", "release_date": "2014-09-04", "status": "latest", "found_by": "rspec", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { "Confirmed 1": { "confidence": 0, "interesting_entries": [ "IE1" ] } }, "vulnerabilities": [ ] } }
wpscan/spec/output/wp_version/not_confirmed_entries.cli_no_colour
[+] WordPress version 4.0 identified (Latest, released on 2014-09-04). | Found By: rspec | - IE1 | - IE2
JSON
wpscan/spec/output/wp_version/not_confirmed_entries.json
{ "version": { "number": "4.0", "release_date": "2014-09-04", "status": "latest", "found_by": "rspec", "confidence": 0, "interesting_entries": [ "IE1", "IE2" ], "confirmed_by": { }, "vulnerabilities": [ ] } }
JSON
wpscan/spec/output/wp_version/not_confirmed_no_entries.json
{ "version": { "number": "4.0", "release_date": "2014-09-04", "status": "latest", "found_by": "rspec", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ ] } }
wpscan/spec/output/wp_version/with_vulns.cli_no_colour
[+] WordPress version 3.8.1 identified (Outdated via api, released on 2014-01-23-via-api). | Found By: rspec | | [!] 2 vulnerabilities identified: | | [!] Title: WP 3.8.1 - Vuln 1 | CVSS: 5.4 (VECTOR) | Reference: https://wpscan.com/vulnerability/1 | | [!] Title: WP 3.8.1 - Vuln 2 | Fixed in: 3.8.2 | References: | - https://wpscan.com/vulnerability/2 | - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-0166 | - url-2 | - url-3
JSON
wpscan/spec/output/wp_version/with_vulns.json
{ "version": { "number": "3.8.1", "release_date": "2014-01-23-via-api", "status": "outdated-via-api", "found_by": "rspec", "confidence": 0, "interesting_entries": [ ], "confirmed_by": { }, "vulnerabilities": [ { "title": "WP 3.8.1 - Vuln 1", "cvss": { "score": "5.4", "vector": "VECTOR" }, "fixed_in": null, "references": { "wpvulndb": [ "1" ] } }, { "title": "WP 3.8.1 - Vuln 2", "fixed_in": "3.8.2", "references": { "cve": [ "2014-0166" ], "url": [ "url-2", "url-3" ], "wpvulndb": [ "2" ] } } ] } }
Ruby
wpscan/spec/shared_examples/references.rb
# frozen_string_literal: true shared_examples WPScan::References do describe '#references_keys' do it 'contains the :wpvulndb symbol' do expect(subject.class.references_keys) .to include(:wpvulndb) end end describe 'references' do context 'when no references' do its(:wpvulndb_ids) { should eql([]) } its(:wpvulndb_urls) { should eql([]) } its(:references_urls) { should eql([]) } end context 'when an unknown reference key is provided' do let(:references) { { cve: 1, unknown: 12 } } its(:references) { should eql(cve: %w[1]) } end context 'when references provided as string' do let(:references) do { cve: 11, wpvulndb: 12 } end its(:cves) { should eql %w[11] } its(:cve_urls) { should eql %w[https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-11] } its(:wpvulndb_ids) { should eql %w[12] } its(:wpvulndb_urls) { should eql %w[https://wpscan.com/vulnerability/12] } its(:references_urls) do should eql [ 'https://wpscan.com/vulnerability/12', 'https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-11' ] end end context 'when references provided as array' do xit end end end
Ruby
wpscan/spec/shared_examples/dynamic_finders/wp_items.rb
# frozen_string_literal: true shared_examples WPScan::Finders::DynamicFinder::WpItems::Finder do let(:passive_fixture) do fixtures.join("#{described_class.to_s.demodulize.underscore}_passive_all.html") end describe '#passive_configs' do # Not sure if it's worth to do it as it's just a call to something tested # and an exception will be raised if the method called is wrong end describe '#aggressive_configs' do # Same as above end describe '#passive' do before do stub_request(:get, target.url).to_return(body: homepage_body) stub_request(:get, ERROR_404_URL_PATTERN).to_return(body: error_404_body) allow(target).to receive(:content_dir).and_return('wp-content') end context 'when no matches' do let(:homepage_body) { '' } let(:error_404_body) { '' } it 'returns an empty array' do expect(finder.passive).to eql([]) end end context 'when matches' do let(:expected_items) do expected = [] finder.passive_configs.each do |slug, configs| configs.each_key do |finder_class| expected_finding_opts = expected_all[slug][finder_class] expected << item_class.new( slug, target, confidence: expected_finding_opts['confidence'] || described_class::DEFAULT_CONFIDENCE, found_by: expected_finding_opts['found_by'] ) end end expected end context 'from the homepage' do let(:homepage_body) { File.read(passive_fixture) } let(:error_404_body) { '' } it 'contains the expected items' do expect(finder.passive).to match_array(expected_items.map { |item| eql(item) }) end end context 'from the 404' do let(:homepage_body) { '' } let(:error_404_body) { File.read(passive_fixture) } it 'contains the expected items' do expect(finder.passive).to match_array(expected_items.map { |item| eql(item) }) end end context 'from both the homepage and 404' do let(:homepage_body) { File.read(passive_fixture) } let(:error_404_body) { File.read(passive_fixture) } it 'does not contains the same finding twice (but from different page)' do expect(finder.passive).to match_array(expected_items.map { |item| eql(item) }) end end end end describe '#aggressive' do its(:aggressive) { should be nil } end xdescribe '#aggressive' do # TODO: Maybe also stub all paths to an empty body and expect an empty array ? before do @expected = [] allow(target).to receive(:content_dir).and_return('wp-content') # Stubbing all requests to the different paths finder.aggressive_configs.each do |slug, configs| configs.each do |finder_class, config| finder_super_class = config['class'] || finder_class fixture = fixtures.join(slug, finder_class.underscore, config['path']) stubbed_response = df_stubbed_response(fixture, finder_super_class) path = finder.aggressive_path(slug, config) expected_finding_opts = expected_all[slug][finder_class] stub_request(:get, target.url(path)).to_return(stubbed_response) @expected << item_class.new( slug, target, confidence: expected_finding_opts['confidence'] || described_class::DEFAULT_CONFIDENCE, found_by: expected_finding_opts['found_by'] ) end end end it 'returns the expected items' do expect(finder.aggressive).to match_array(@expected.map { |item| eql(item) }) end end end
Ruby
wpscan/spec/shared_examples/finders/wp_items/urls_in_page.rb
# frozen_string_literal: true shared_examples 'App::Finders::WpItems::UrlsInPage' do before do allow(finder.target).to receive(:content_dir).and_return('wp-content') stub_request(:get, page_url).to_return(body: defined?(body) ? body : File.read(fixtures.join(fixture))) end describe '#items_from_links' do context 'when none found' do let(:fixture) { 'none.html' } it 'returns an empty array' do expect(finder.items_from_links(type)).to eql([]) end end context 'when found' do let(:fixture) { 'found.html' } it 'returns the expected array' do expect(finder.items_from_links(type, uniq: uniq_links)).to eql expected_from_links end end context 'when a lof of unrelated links' do let(:body) do Array.new(250) { |i| "<a href='#{url}#{i}.html'>Link</a><img src='#{url}img-#{i}.gif'/>" }.join("\n") end it 'should not take a while to process the page' do time_start = Time.now expect(finder.items_from_links(type)).to eql [] time_end = Time.now expect(time_end - time_start).to be < 1 end end end describe '#items_from_codes' do context 'when none found' do let(:fixture) { 'none.html' } it 'returns an empty array' do expect(finder.items_from_codes(type)).to eql([]) end end context 'when found' do let(:fixture) { 'found.html' } it 'returns the expected array' do expect(finder.items_from_codes(type, uniq: uniq_codes)).to eql expected_from_codes end end end end
Ruby
wpscan/spec/shared_examples/target/platform/wordpress.rb
# frozen_string_literal: true require_relative 'wordpress/custom_directories' shared_examples WPScan::Target::Platform::WordPress do it_behaves_like 'WordPress::CustomDirectories' let(:fixtures) { FIXTURES.join('target', 'platform', 'wordpress') } describe '#wordpress?, wordpress_from_meta_comments_or_scripts?' do let(:fixtures) { super().join('detection') } before do stub_request(:get, target.url).to_return(body: File.read(fixtures.join("#{homepage}.html"))) stub_request(:get, ERROR_404_URL_PATTERN).to_return(body: File.read(fixtures.join("#{page404}.html"))) end context 'when pattern/s in the homepage' do let(:page404) { 'not_wp' } %w[default wp_includes only_scripts meta_generator comments mu_plugins wp_admin wp_json_oembed].each do |file| context "when a wordpress page (#{file}.html)" do let(:homepage) { file } it 'returns true' do expect(subject.wordpress?(:mixed)).to be true end end end end context 'when no clues in the homepage' do let(:homepage) { 'not_wp' } context 'when pattern/s in the 404 page' do %w[default wp_includes only_scripts meta_generator comments mu_plugins wp_admin wp_json_oembed].each do |file| context "when a wordpress page (#{file}.html)" do let(:page404) { file } it 'returns true' do expect(subject.wordpress?(:mixed)).to be true end end end end context 'when no clues in the 404 page' do let(:page404) { 'not_wp' } context 'when only passive detection mode' do it 'returns false' do expect(subject.wordpress?(:passive)).to be false end end context 'when mixed or aggressive detection modes' do context 'when wp-admin/install.php and wp-login.php not there' do it 'returns false' do %w[wp-admin/install.php wp-login.php].each do |path| stub_request(:get, target.url(path)).to_return(status: 404) end expect(subject.wordpress?(:mixed)).to be false end end context 'when wp-admin/install.php is matching a WP install' do it 'returns true' do stub_request(:get, target.url('wp-admin/install.php')) .to_return(body: File.read(fixtures.join('wp-admin-install.php'))) expect(subject.wordpress?(:mixed)).to be true end end context 'when wp-admin/install.php not there but wp-login.php is matching a WP install' do it 'returns true' do stub_request(:get, target.url('wp-admin/install.php')).to_return(status: 404) stub_request(:get, target.url('wp-login.php')) .to_return(body: File.read(fixtures.join('wp-login.php'))) expect(subject.wordpress?(:mixed)).to be true end end context 'when a lot of irrelevant links' do let(:body) do Array.new(250) do |i| "<a href='#{subject.url}#{i}.html>Link</a><img src='#subject.{url}img-#{i}.png'/>" end.join("\n") end it 'should not take a while to process check' do stub_request(:get, target.url('wp-admin/install.php')).to_return(body: body) stub_request(:get, target.url('wp-login.php')).to_return(body: body) time_start = Time.now expect(subject.wordpress?(:mixed)).to be false time_end = Time.now expect(time_end - time_start).to be < 1 end end end end end end describe '#maybe_add_cookies' do let(:fixtures) { super().join('maybe_add_cookies') } let(:browser) { WPScan::Browser.instance } context 'when nothing matches' do it 'does nothing' do stub_request(:get, target.url).to_return(body: 'nothing there') subject.maybe_add_cookies expect(browser.cookie_string).to eql nil expect(subject.homepage_res.body).to eql 'nothing there' end end context 'when matches' do before do stub_request(:get, target.url) .to_return( { body: File.read(fixtures.join("#{cookie}.html")) }, body: 'Cookies Accepted!' # if we put {} there, ruobop not happy! ) end { 'vjs' => 'vjs=2420671338' }.each do |key, expected_cookie_string| context "when #{key} match" do let(:cookie) { key } context 'when the browser does not have a cookie_string already' do before do subject.maybe_add_cookies # This one does not work, opened an issue # https://github.com/bblimke/webmock/issues/813 # stub_request(:get, target.url) # .with(headers: { 'Cookie' => expected_cookie_string }) # .to_return(body: 'Cookies Accepted!') end it 'sets the correct cookies, reset the homepage_res' do expect(browser.cookie_string).to eql expected_cookie_string expect(subject.homepage_res.body).to eql 'Cookies Accepted!' end end context 'when the browser has cookie_string already' do before do browser.cookie_string = 'key=no-override' subject.maybe_add_cookies # This one does not work, opened an issue # https://github.com/bblimke/webmock/issues/813 # stub_request(:get, target.url) # .with(headers: { 'Cookie' => "#{expected_cookie_string}; key=no-override" }) # .to_return(body: 'Cookies Accepted!') end it 'sets the correct cookies, reset the homepage_res' do expect(browser.cookie_string).to eql "#{expected_cookie_string}; key=no-override" expect(subject.homepage_res.body).to eql 'Cookies Accepted!' end end end end end end describe '#wordpress_hosted?' do let(:fixtures) { super().join('wordpress_hosted') } context 'when the target host matches' do let(:url) { 'http://ex.wordpress.com' } its(:wordpress_hosted?) { should be true } end context 'when the target host doesn\'t matches' do let(:url) { 'http://ex-wordpress.com' } context 'when wp-content not detected' do before do expect(target).to receive(:content_dir).and_return(nil) stub_request(:get, target.url) .to_return(body: defined?(body) ? body : File.read(fixtures.join(fixture).to_s)) end context 'when an src URL matches a WP hosted' do let(:fixture) { 'match_src.html' } its(:wordpress_hosted?) { should be true } end context 'when an href URL matches a WP hosted' do let(:fixture) { 'match_href.html' } its(:wordpress_hosted?) { should be true } end context 'when URLs don\'t match' do let(:fixture) { 'no_match.html' } its(:wordpress_hosted?) { should be false } end context 'when a lof of unrelated urls' do let(:body) do Array.new(250) { |i| "<a href='#{url}#{i}.html'>Some Link</a><img src='#{url}img-#{i}.png'/>" }.join("\n") end it 'should not take a while to process the page' do time_start = Time.now expect(target.wordpress_hosted?).to be false time_end = Time.now expect(time_end - time_start).to be < 1 end end end context 'when wp-content detected' do before { expect(target).to receive(:content_dir).and_return('wp-content') } its(:wordpress_hosted?) { should be false } end end end describe '#login_url' do before do allow(target).to receive(:sub_dir) WPScan::ParsedCli.options = rspec_parsed_options(cli_args) end let(:cli_args) { '--url https://ex.lo' } context 'when login_uri CLI option set' do let(:cli_args) { "#{super()} --login_uri other-login.php" } its(:login_url) { should eql target.url('other-login.php') } end context 'when returning a 200' do before { stub_request(:get, target.url('wp-login.php')).to_return(status: 200) } its(:login_url) { should eql target.url('wp-login.php') } end context 'when a 404' do before { stub_request(:get, target.url('wp-login.php')).to_return(status: 404) } its(:login_url) { should eql false } end context 'when a redirection occured' do before do expect(WPScan::Browser).to receive(:get_and_follow_location) .and_return(Typhoeus::Response.new(effective_url: effective_url, body: '')) end context 'to an in scope URL' do context 'when https version of the wp-login' do let(:effective_url) { target.url('wp-login.php').gsub('http', 'https') } its(:login_url) { should eql effective_url } end context 'when something else' do let(:effective_url) { target.url('something').gsub('http', 'https') } its(:login_url) { should eql target.url('wp-login.php') } end end context 'to an out of scope URL' do let(:effective_url) { 'http://something.else' } its(:login_url) { should eql target.url('wp-login.php') } end end end end
Ruby
wpscan/spec/shared_examples/target/platform/wordpress/custom_directories.rb
# frozen_string_literal: true shared_examples 'WordPress::CustomDirectories' do let(:fixtures) { super().join('custom_directories') } describe '#content_dir' do # Stub the error_404_res to make it easier to test before { stub_request(:get, ERROR_404_URL_PATTERN) } { default: 'wp-content', https: 'wp-content', custom_w_spaces: 'custom content spaces', relative_one: 'wp-content', relative_two: 'wp-content', cache: 'wp-content', in_raw_js: 'wp-content', in_raw_js_escaped: 'wp-content', with_sub_dir: 'app', relative_two_sub_dir: 'cms/wp-content', in_meta_content: 'wp-content', themes_path_plugin_folder: 'wp-content', simple_link: nil }.each do |file, expected| it "returns #{expected} for #{file}.html" do stub_request(:get, target.url).to_return(body: File.read(fixtures.join("#{file}.html"))) # For cases where the expected is nil allow(target).to receive(:default_content_dir_exists?).and_return(false) expect(target.content_dir).to eql expected end end context 'when scope given' do let(:opts) { super().merge(scope: ['*.cloudfront.net']) } { scope: 'wp-content', scope_meta_content: 'wp-content' }.each do |file, expected| it "returns #{expected} for #{file}.html" do stub_request(:get, target.url).to_return(body: File.read(fixtures.join("#{file}.html"))) expect(target.content_dir).to eql expected end end end context 'when the target URL is invalid according to PublicSuffix and contains a port' do let(:url) { 'http://wp-lab:82/aa' } it 'returns wp-content when matches' do stub_request(:get, target.url).to_return(body: File.read(fixtures.join('with_port.html'))) expect(target.content_dir).to eql 'wp-content' end end context 'when not found via the homepage or 404' do before do stub_request(:get, target.url) expect(target).to receive(:default_content_dir_exists?).and_return(dir_exist) end context 'when default dir does not exist' do let(:dir_exist) { false } it 'returns nil' do expect(target.content_dir).to eql nil end end context 'when default dir exists' do let(:dir_exist) { true } it 'returns wp-content' do expect(target.content_dir).to eql 'wp-content' end end end end describe 'default_content_dir_exists?' do before do expect(target).to receive(:head_or_get_params).and_return(method: :head) stub_request(:head, target.uri.join('wp-content/').to_s).to_return(status: status) end context 'when 404' do let(:status) { 404 } its(:default_content_dir_exists?) { should be false } end context 'when 200, 401 or 403' do [200, 401, 403].each do |code| let(:status) { code } its(:default_content_dir_exists?) { should be true } end end end describe '#content_dir=, #plugins_dir=' do %w[wp-content wp-custom].each do |dir| context "when content_dir = #{dir} and no plugins_dir" do before { target.content_dir = dir } its(:content_dir) { should eq dir.chomp('/') } its(:plugins_dir) { should eq "#{dir.chomp('/')}/plugins" } end context "when content_dir = #{dir} and plugins_dir = #{dir}" do before do target.content_dir = dir target.plugins_dir = dir end its(:content_dir) { should eq dir.chomp('/') } its(:plugins_dir) { should eq dir.chomp('/') } end end end describe '#content_uri, #content_url, #plugins_uri, #plugins_url' do before { target.content_dir = 'wp-content' } its(:content_uri) { should eq Addressable::URI.parse("#{url}/wp-content/") } its(:content_url) { should eq "#{url}/wp-content/" } its(:plugins_uri) { should eq Addressable::URI.parse("#{url}/wp-content/plugins/") } its(:plugins_url) { should eq "#{url}/wp-content/plugins/" } end describe '#sub_dir' do # Stub the error_404_res to make it easier to test before { stub_request(:get, ERROR_404_URL_PATTERN) } { default: false, with_sub_dir: 'wp', relative_two_sub_dir: 'cms' }.each do |file, expected| it "returns #{expected} for #{file}.html" do fixture = File.join(fixtures, "#{file}.html") stub_request(:get, target.url).to_return(body: File.read(fixture)) expect(target.sub_dir).to eql expected end end context 'when no sub_dir detected' do it 'only checks the in_scope_uris once' do stub_request(:get, target.url).to_return(body: File.read(File.join(fixtures, 'default.html'))) expect(target.sub_dir).to eql false expect(target).to_not receive(:in_scope_uris) expect(target.sub_dir).to eql false end end context 'when a lot of irrelevant urls' do let(:body) do Array.new(250) do |i| "<a href='#{subject.url}#{i}.html>Link</a><img src='#subject.{url}img-#{i}.png'/>" end.join("\n") end it 'should not take a while to detect the sub_dir' do stub_request(:get, target.url).to_return(body: body) time_start = Time.now expect(target.sub_dir).to eql false time_end = Time.now expect(time_end - time_start).to be < 1 end end end describe '#url' do after { expect(target.url(@path)).to eql @expected } context 'when no path supplied' do it 'returns the target url' do @path = nil @expected = "#{url}/" end end context 'when no sub_dir' do it 'does not add it' do expect(target).to receive(:sub_dir).and_return(false) @path = 'something' @expected = "#{url}/#{@path}" end end context 'when sub_dir' do it 'adds it to the path' do expect(target).to receive(:sub_dir).at_least(1).and_return('wp') @path = 'path' @expected = "#{url}/wp/path" end context 'when the path starts with /' do it 'does not add it' do @path = '/root' @expected = "#{url}/root" end end end context 'when default directories' do before { target.content_dir = 'wp-content' } it 'does not replace the wp-content' do @path = 'wp-content/themes/something' @expected = "#{url}/#{@path}" end end context 'when custom directories' do # Ensures non custom wp dir path are not replaced after do expect(target).to receive(:sub_dir).at_least(1).and_return(false) expect(target.url('not-wp-dir/spec.html')).to eql "#{url}/not-wp-dir/spec.html" end context 'when custom plugins dir' do before do target.content_dir = 'wp-content' target.plugins_dir = 'custom-plugins' end it 'replaces wp-content/plugins' do @path = 'wp-content/plugins/p1/file.txt' @expected = "#{url}/custom-plugins/p1/file.txt" end it 'does not replace wp-content' do @path = 'wp-content/themes/t1' @expected = "#{url}/wp-content/themes/t1" end end context 'when custom content dir' do before { target.content_dir = 'custom-content' } it 'replaces wp-content' do @path = 'wp-content/plugins/p1' @expected = "#{url}/custom-content/plugins/p1" end end # Special case when for example, custom directories are # supplied by the user: the plugin dir can the default one, # but the content dir could be a custom (very rare case) context 'when custom content and default plugins directories' do before do target.content_dir = 'custom-content' target.plugins_dir = 'wp-content/plugins' end it 'does not replace wp-content/plugins ' do @path = 'wp-content/plugins/p1/spec.html' @expected = "#{url}/#{@path}" end it 'replaces wp-content' do @path = 'wp-content/themes/t1' @expected = "#{url}/custom-content/themes/t1" end end context 'when custom content and plugins directories' do before do target.content_dir = 'custom-content' target.plugins_dir = 'custom-plugins' end it 'replaces wp-content/plugins' do @path = 'wp-content/plugins/p1/file.txt' @expected = "#{url}/custom-plugins/p1/file.txt" end it 'replaces wp-content' do @path = 'wp-content/themes/t1' @expected = "#{url}/custom-content/themes/t1" end end end end end
Ruby
wpscan/spec/shared_examples/views/enumeration.rb
# frozen_string_literal: true require_relative 'enumeration/users' require_relative 'enumeration/medias' require_relative 'enumeration/themes' require_relative 'enumeration/plugins' require_relative 'enumeration/timthumbs' require_relative 'enumeration/config_backups' require_relative 'enumeration/db_exports' shared_examples 'App::Views::Enumeration' do let(:controller) { WPScan::Controller::Enumeration.new } let(:tpl_vars) { { url: target_url } } it_behaves_like 'App::Views::Enumeration::Users' it_behaves_like 'App::Views::Enumeration::Medias' it_behaves_like 'App::Views::Enumeration::Themes' it_behaves_like 'App::Views::Enumeration::Plugins' it_behaves_like 'App::Views::Enumeration::Timthumbs' it_behaves_like 'App::Views::Enumeration::ConfigBackups' it_behaves_like 'App::Views::Enumeration::DbExports' end
Ruby
wpscan/spec/shared_examples/views/main_theme.rb
# frozen_string_literal: true shared_examples 'App::Views::MainTheme' do let(:controller) { WPScan::Controller::MainTheme.new } let(:tpl_vars) { { url: target_url } } let(:theme) { WPScan::Model::Theme.new(theme_name, target, found_by: 'rspec') } describe 'main_theme' do let(:view) { 'theme' } context 'when no theme found' do let(:expected_view) { 'not_found' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(theme: nil) end end context 'when a theme found' do let(:theme_name) { 'test' } before do expect(target).to receive(:content_dir).at_least(1).and_return('wp-content') # Stub all requests to 200, to detect the readme. # Detection of the error_log will fail as the empty body won't match the patterns stub_request(:head, /.*/) stub_request(:get, /.*/) stub_request(:get, /.*\.css\z/) .to_return(body: File.read(FIXTURES.join('models', 'theme', 'style.css'))) end context 'when no verbose' do let(:expected_view) { 'no_verbose' } it 'outputs the expected string' do expect(theme).to receive(:version).at_least(1) @tpl_vars = tpl_vars.merge(theme: theme) end end context 'when verbose' do let(:expected_view) { 'verbose' } it 'outputs the expected string' do expect(theme) .to receive(:version) .at_least(1) .and_return(WPScan::Model::Version.new('3.2', found_by: 'style')) @tpl_vars = tpl_vars.merge(theme: theme, verbose: true) end end context 'when vulnerable' do let(:expected_view) { 'vulnerable' } let(:theme_name) { 'dignitas-themes' } it 'outputs the expected string' do expect(theme).to receive(:version).at_least(1) allow(theme).to receive(:db_data).and_return(vuln_api_data_for('themes/dignitas-themes')) @tpl_vars = tpl_vars.merge(theme: theme, verbose: true) end end end end end
Ruby
wpscan/spec/shared_examples/views/vuln_api.rb
# frozen_string_literal: true shared_examples 'App::Views::VulnApi' do let(:controller) { WPScan::Controller::VulnApi.new } let(:tpl_vars) { { url: target_url } } describe 'status' do let(:view) { 'status' } context 'when no api token is given' do let(:expected_view) { 'no_token' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(status: {}) end end context 'when http error' do let(:expected_view) { 'http_error' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge( status: { 'http_error' => WPScan::Error::HTTP.new(Typhoeus::Response.new(effective_url: 'url', return_code: 28)) } ) end end context 'when no more remaining requests' do let(:expected_view) { 'no_more_requests' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge( status: { 'success' => true, 'plan' => 'free', 'requests_remaining' => 0 }, api_requests: 3 ) end end context 'when everything is fine' do let(:expected_view) { 'all_ok' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge( status: { 'success' => true, 'plan' => 'paid', 'requests_remaining' => 120 }, api_requests: 3 ) end end context 'when unlimited requests' do let(:expected_view) { 'unlimited_requests' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge( status: { 'success' => true, 'plan' => 'enterprise', 'requests_remaining' => 'Unlimited' }, api_requests: 3 ) end end end end
Ruby
wpscan/spec/shared_examples/views/wp_version.rb
# frozen_string_literal: true shared_examples 'App::Views::WpVersion' do let(:controller) { WPScan::Controller::WpVersion.new } let(:tpl_vars) { { url: target_url } } describe 'version' do let(:view) { 'version' } context 'when the version is nil' do let(:expected_view) { 'not_found' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(version: nil) end end context 'when the version is not nil' do let(:version) { WPScan::Model::WpVersion.new('4.0', found_by: 'rspec') } before { allow(version).to receive(:db_data).and_return(vuln_api_data_for('wordpresses/40')) } context 'when confirmed_by is empty' do context 'when no interesting_entries' do let(:expected_view) { 'not_confirmed_no_entries' } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(version: version) end end context 'when interesting_entries' do let(:expected_view) { 'not_confirmed_entries' } it 'outputs the expected string' do version.interesting_entries << 'IE1' << 'IE2' @tpl_vars = tpl_vars.merge(version: version) end end end context 'when confirmed_by is not empty' do let(:confirmed1) do v = version.dup v.found_by = 'Confirmed 1' v.interesting_entries << 'IE1' v end let(:confirmed2) do v = version.dup v.found_by = 'Confirmed 2' v.interesting_entries << 'IE1' << 'IE2' v end context 'when one confirmed_by' do let(:expected_view) { 'confirmed_one' } it 'outputs the expected string' do f = WPScan::Finders::Findings.new << version << confirmed1 @tpl_vars = tpl_vars.merge(version: f.first) end end context 'when multiple confirmed_by' do let(:expected_view) { 'confirmed_multiples' } it 'outputs the expected string' do f = WPScan::Finders::Findings.new << version << confirmed1 << confirmed2 @tpl_vars = tpl_vars.merge(version: f.first) end end end end context 'when the version is vulnerable' do let(:expected_view) { 'with_vulns' } let(:version) { WPScan::Model::WpVersion.new('3.8.1', found_by: 'rspec') } before { allow(version).to receive(:db_data).and_return(vuln_api_data_for('wordpresses/381')) } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(version: version) end end end end
Ruby
wpscan/spec/shared_examples/views/enumeration/config_backups.rb
# frozen_string_literal: true shared_examples 'App::Views::Enumeration::ConfigBackups' do let(:view) { 'config_backups' } let(:config_backup) { WPScan::Model::ConfigBackup } describe 'config_backups' do context 'when no backups found' do let(:expected_view) { File.join(view, 'none_found') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(config_backups: []) end end context 'when backups found' do xit end end end
Ruby
wpscan/spec/shared_examples/views/enumeration/db_exports.rb
# frozen_string_literal: true shared_examples 'App::Views::Enumeration::DbExports' do let(:view) { 'db_exports' } let(:db_export) { WPScan::Model::DbExport } describe 'db_exports' do context 'when no file found' do let(:expected_view) { File.join(view, 'none_found') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(db_exports: []) end end context 'when files found' do xit end end end
Ruby
wpscan/spec/shared_examples/views/enumeration/medias.rb
# frozen_string_literal: true shared_examples 'App::Views::Enumeration::Medias' do let(:view) { 'medias' } let(:media) { WPScan::Model::Media } describe 'medias' do context 'when no medias found' do let(:expected_view) { File.join(view, 'none_found') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(medias: []) end end context 'when medias found' do let(:m1) { media.new("#{target_url}?attachment_id=1", found_by: 'Attachment Brute Forcing') } let(:m2) { media.new("#{target_url}?attachment_id=5", found_by: 'Attachment Brute Forcing') } let(:medias) { [m1, m2] } let(:expected_view) { File.join(view, 'medias') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(medias: medias) end end end end
Ruby
wpscan/spec/shared_examples/views/enumeration/plugins.rb
# frozen_string_literal: true shared_examples 'App::Views::Enumeration::Plugins' do let(:view) { 'plugins' } let(:plugin) { WPScan::Model::Plugin } describe 'plugins' do context 'when no plugins found' do let(:expected_view) { File.join(view, 'none_found') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(plugins: []) end end context 'when plugins found' do xit end end end
Ruby
wpscan/spec/shared_examples/views/enumeration/themes.rb
# frozen_string_literal: true shared_examples 'App::Views::Enumeration::Themes' do let(:view) { 'themes' } let(:plugin) { WPScan::Model::Theme } describe 'themes' do context 'when no themes found' do let(:expected_view) { File.join(view, 'none_found') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(themes: []) end end context 'when themes found' do xit end end end
Ruby
wpscan/spec/shared_examples/views/enumeration/timthumbs.rb
# frozen_string_literal: true shared_examples 'App::Views::Enumeration::Timthumbs' do let(:view) { 'timthumbs' } let(:timthumb) { WPScan::Model::Timthumb } let(:version) { WPScan::Model::Version.new('2.8.14', found_by: 'Bad Request') } describe 'timthumbs' do context 'when no timthumbs found' do let(:expected_view) { File.join(view, 'none_found') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(timthumbs: []) end end context 'when timthumbs found' do let(:tt) { timthumb.new("#{target_url}tt.php", found_by: 'Known Locations') } let(:tt2) { timthumb.new("#{target_url}tt2.php", found_by: 'Known Locations') } let(:timthumbs) { [tt, tt2] } context 'when not vulnerable' do let(:expected_view) { File.join(view, 'no_vulns') } it 'outputs the expected string' do expect(timthumbs[0]).to receive(:version).at_least(1).and_return(version) expect(timthumbs[1]).to receive(:version).at_least(1).and_return(version) @tpl_vars = tpl_vars.merge(timthumbs: timthumbs) end end context 'when vulnerable' do let(:expected_view) { File.join(view, 'with_vulns') } it 'outputs the expected string' do expect(timthumbs[0]).to receive(:version).at_least(1).and_return(false) expect(timthumbs[1]).to receive(:version).at_least(1).and_return(version) @tpl_vars = tpl_vars.merge(timthumbs: timthumbs) end end end end end
Ruby
wpscan/spec/shared_examples/views/enumeration/users.rb
# frozen_string_literal: true shared_examples 'App::Views::Enumeration::Users' do let(:view) { 'users' } let(:user) { WPScan::Model::User } describe 'users' do context 'when no users found' do let(:expected_view) { File.join(view, 'none_found') } it 'outputs the expected string' do @tpl_vars = tpl_vars.merge(users: []) end end context 'when users found' do let(:expected_view) { File.join(view, 'users') } xit 'outputs the expected string' end end end
x64dbg-development/.editorconfig
; Top-most EditorConfig file root = true ; Windows-style newlines [*] end_of_line = CRLF ; Tab indentation [*.{cpp,h}] indent_style = space tab_width = 4
x64dbg-development/.gitignore
# Ignored directories bin/*/ obj/ ipch/ Win32/ x64/ release/ build/ gui_build/ debug/ *XE Results*/ doxygen*/ doc/ COV/ minidump/ CppDependOut/ .vs/ .vscode/ # Global filetypes to ignore *.depend *.layout *.patch *.cscope_file_list *.bmarks *.chw *.cbTemp *.opensdf *.sdf *.suo *.VC.opendb *.autosave *.~vsd *.dll *.exe *.pro.user.* *.vcxproj.user *.orig cov-int* *.pdb ui_* *.aps *.pro.user .DS_Store *.ipgset pin.log* *.cdproj src/gui/Translations/*.qm x64dbg.VC.db # Project to ignore help/x64*dbg.chm help/output/ bin/x64*dbg.chm bin/win32.* bin/x*.unicode.txt # Debugger files to ignore CppCheckResults.xml src/dbg/ODbgScript.chm src/dbg/ODbgScript.chw # GUI files src/gui/build src/gui/Makefile* tools/ RCa* RDa* RDb* src/build-*/ # Exceptions !/hooks/AStyleHelper.exe !/hooks/AStyle.dll !/bin/x64dbg_shell_remove.reg !/bin/themes/ !*.lib .scannerwork/ bw-output/ build-wrapper* My Amplifier Results - */ My Inspector Results - */ /bin/x96dbg.ini /src/gui/msvc_make.bat
x64dbg-development/.gitmodules
[submodule "src/gui/Translations"] path = src/gui/Translations url = ../Translations.git [submodule "src/dbg/btparser"] path = src/dbg/btparser url = ../btparser [submodule "deps"] path = deps url = ../deps shallow = true [submodule "src/zydis_wrapper/zydis"] path = src/zydis_wrapper/zydis url = ../zydis.git
x64dbg-development/build.bat
@echo off echo Saving PATH if "%OLDPATH%"=="" set OLDPATH=%PATH% cd %~dp0 if /i "%1"=="x32" call setenv.bat x32&set type=Configuration=Release;Platform=Win32&goto build if /i "%1"=="x64" call setenv.bat x64&set type=Configuration=Release;Platform=x64&goto build if /i "%1"=="coverity" goto coverity if /i "%1"=="sonarqube" goto sonarqube goto usage :build echo Building DBG... if "%MAXCORES%"=="" ( msbuild.exe x64dbg.sln /m /verbosity:minimal /t:Rebuild /p:%type% ) else ( set CL=/MP%MAXCORES% msbuild.exe x64dbg.sln /m:1 /verbosity:minimal /t:Rebuild /p:%type% ) if not %ERRORLEVEL%==0 exit echo Building GUI... rmdir /S /Q src\gui_build cd src\gui qmake x64dbg.pro CONFIG+=release if not %ERRORLEVEL%==0 exit if "%MAXCORES%"=="" ( jom ) else ( jom /J %MAXCORES% ) if not %ERRORLEVEL%==0 exit cd ..\.. goto :restorepath :coverity if "%2"=="" ( echo "Usage: build.bat coverity x32/x64" goto usage ) call setenv.bat coverity echo Building with Coverity cov-configure --msvc cov-build --dir cov-int --instrument build.bat %2 goto :restorepath :sonarqube if "%2"=="" ( echo "Usage: build.bat sonarqube x32/x64" goto usage ) echo Building with SonarQube build-wrapper --out-dir bw-output build.bat %2 if not defined APPVEYOR_PULL_REQUEST_NUMBER ( sonar-scanner -Dsonar.projectKey=x64dbg -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=mrexodia-github -Dsonar.login=%SONARQUBE_TOKEN% -Dsonar.exclusions=src/dbg/btparser/**,src/gui_build/**,src/zydis_wrapper/zydis/** ) else ( sonar-scanner -Dsonar.projectKey=x64dbg -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=mrexodia-github -Dsonar.login=%SONARQUBE_TOKEN% -Dsonar.exclusions=src/dbg/btparser/**,src/gui_build/**,src/zydis_wrapper/zydis/** -Dsonar.analysis.mode=preview -Dsonar.github.pullRequest=%APPVEYOR_PULL_REQUEST_NUMBER% -Dsonar.github.repository=x64dbg/x64dbg -Dsonar.github.oauth=%GITHUB_TOKEN% ) goto :restorepath :usage echo "Usage: build.bat x32/x64/coverity" echo. echo Examples: echo build.bat x32 : builds 32-bit release build echo build.bat x64 : builds 64-bit release build echo build.bat coverity x32 : builds 32-bit coverity build echo build.bat coverity x64 : builds 64-bit coverity build goto :restorepath :restorepath echo Resetting PATH set PATH=%OLDPATH% set OLDPATH=
x64dbg-development/clean.bat
@echo off echo Cleaning base directory... del /Q *.sdf del /Q *.layout del /Q /A H *.suo rmdir /S /Q ipch rmdir /S /Q release rmdir /S /Q build rmdir /S /Q cov-int echo Cleaning BRIDGE... cd src\bridge call :delfiles echo Cleaning DBG... cd src\dbg call :delfiles echo Cleaning EXE... cd src\exe call :delfiles echo Cleaning LAUNCHER... cd src\launcher call :delfiles echo Cleaning GUI SRC... rmdir /S /Q src\gui_build echo Cleaning GUI... cd src/gui rmdir /S /Q build del /Q Makefile* del /Q *.pdb cd ..\.. echo Cleaning bin\ del /Q bin\*.pdb del /Q bin\*.exp del /Q bin\*.a del /Q bin\*.lib del /Q bin\*.def del /Q bin\x96dbg.exe echo Cleaning bin\x32... rmdir /S /Q bin\x32\db del /Q bin\x32\*.pdb del /Q bin\x32\*.exp del /Q bin\x32\*.a del /Q bin\x32\*.lib del /Q bin\x32\*.def del /Q bin\x32\x32dbg.exe del /Q bin\x32\x32dbg.dll del /Q bin\x32\x32gui.dll del /Q bin\x32\x32bridge.dll echo Cleaning bin\x64... rmdir /S /Q bin\x64\db del /Q bin\x64\*.pdb del /Q bin\x64\*.exp del /Q bin\x64\*.a del /Q bin\x64\*.lib del /Q bin\x64\*.def del /Q bin\x64\x64dbg.exe del /Q bin\x64\x64dbg.dll del /Q bin\x64\x64gui.dll del /Q bin\x64\x64bridge.dll echo Cleaning help... cd help del /Q *.chm rmdir /S /Q output echo Done! exit 0 :delfiles rmdir /S /Q obj rmdir /S /Q Win32 rmdir /S /Q x64 del /Q *.bmarks del /Q *.layout del /Q *.depend del /Q *.pdb cd ..\..
x64dbg-development/install.bat
@echo off echo Run this to install the auto-format hook. git config core.autocrlf false copy hooks\pre-commit .git\hooks\pre-commit
x64dbg-development/LICENSE
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 THIS DOCUMENT HAS BEEN MODIFIED Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Treatment of plugins This license does not affect plugins, i.e., dynamically linked libraries, that use the provided plugin interface mechanism of x64dbg for contibuting additional features to the x64dbg project and can only be run from x64dbg. In fact you are allowed to create and share (non-)commercial, non-standalone closed-source plugins for x64dbg under your own license. 3. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 4. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 5. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 6. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 7. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 8. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 9. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 10. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 11. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 12. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 13. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 14. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 15. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 16. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 17. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 18. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
x64dbg-development/maketranslatetemplate.bat
@echo off echo Run this to update translation templates after the source is modified. Be sure to set Qt path in setenv.bat call setenv.bat x64 lupdate src/x64dbg_translations.pro
Markdown
x64dbg-development/README.md
# x64dbg <img width="100" src="https://github.com/x64dbg/x64dbg/raw/development/src/bug_black.png"/> [![Build status](https://ci.appveyor.com/api/projects/status/h1j489qa1mx67e0h?svg=true)](https://ci.appveyor.com/project/mrexodia/x64dbg) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/x64dbg/localized.svg)](https://translate.x64dbg.com) [![Download x64dbg](https://img.shields.io/sourceforge/dm/x64dbg.svg)](https://sourceforge.net/projects/x64dbg/files/latest/download) [![Discord](https://img.shields.io/badge/chat-on%20Discord-green.svg)](https://invite.gg/x64dbg) [![Telegram](https://img.shields.io/badge/chat-%20on%20Telegram-blue.svg)](https://telegram.me/x64dbg) [![Gitter](https://img.shields.io/badge/chat-on%20Gitter-lightseagreen.svg)](https://gitter.im/x64dbg/x64dbg) [![Matrix](https://img.shields.io/badge/chat-on%20Matrix-yellowgreen.svg)](https://riot.im/app/#/room/#x64dbg:matrix.org) An open-source binary debugger for Windows, aimed at malware analysis and reverse engineering of executables you do not have the source code for. There are many features available and a comprehensive [plugin system](https://plugins.x64dbg.com) to add your own. You can find more information on the [blog](https://x64dbg.com/blog)! ## Screenshots ![main interface (light)](.github/screenshots/cpu-light.png) ![main interface (dark)](.github/screenshots/cpu-dark.png) | ![graph](.github/screenshots/graph-light.png) | ![memory map](.github/screenshots/memory-map-light.png) | | :--: | :--: | ## Installation & Usage 1. Download a snapshot from [GitHub](https://github.com/x64dbg/x64dbg/releases), [SourceForge](https://sourceforge.net/projects/x64dbg/files/snapshots) or [OSDN](https://osdn.net/projects/x64dbg) and extract it in a location your user has write access to. 2. _Optionally_ use `x96dbg.exe` to register a shell extension and add shortcuts to your desktop. 3. You can now run `x32\x32dbg.exe` if you want to debug a 32-bit executable or `x64\x64dbg.exe` to debug a 64-bit executable! If you are unsure you can always run `x96dbg.exe` and chose your architecture there. You can also [compile](https://github.com/x64dbg/x64dbg/wiki/Compiling-the-whole-project) x64dbg yourself with a few easy steps! ## Sponsors [![](.github/sponsors/malcore.png)](https://sponsors.x64dbg.com/malcore) <br> [![](.github/sponsors/telekom.svg)](https://sponsors.x64dbg.com/telekom) ## Contributing This is a community effort and we accept pull requests! See the [CONTRIBUTING](.github/CONTRIBUTING.md) document for more information. If you have any questions you can always [contact us](https://x64dbg.com/#contact) or open an [issue](https://github.com/x64dbg/x64dbg/issues). You can take a look at the [good first issues](https://easy.x64dbg.com/) to get started. ## Credits - Debugger core by [TitanEngine Community Edition](https://github.com/x64dbg/TitanEngine) - Disassembly powered by [Zydis](https://zydis.re) - Assembly powered by [XEDParse](https://github.com/x64dbg/XEDParse) and [asmjit](https://github.com/asmjit) - Import reconstruction powered by [Scylla](https://github.com/NtQuery/Scylla) - JSON powered by [Jansson](https://www.digip.org/jansson) - Database compression powered by [lz4](https://bitbucket.org/mrexodia/lz4) - Bug icon by [VisualPharm](https://www.visualpharm.com) - Interface icons by [Fugue](https://p.yusukekamiyamane.com) - Website by [tr4ceflow](https://tr4ceflow.com) ## Developers - [mrexodia](https://mrexodia.github.io) - Sigma - [tr4ceflow](https://blog.tr4ceflow.com) - [Dreg](https://www.fr33project.org) - [Nukem](https://github.com/Nukem9) - [Herz3h](https://github.com/Herz3h) - [torusrxxx](https://github.com/torusrxxx) ## Code contributions You can find an exhaustive list of GitHub contributors [here](https://github.com/x64dbg/x64dbg/graphs/contributors). ## Special Thanks - Sigma for developing the initial GUI - All the donators! - Everybody adding issues! - People I forgot to add to this list - [Writers of the blog](https://x64dbg.com/blog/2016/07/09/Looking-for-writers.html)! - [EXETools community](https://forum.exetools.com) - [Tuts4You community](https://forum.tuts4you.com) - [ReSharper](https://www.jetbrains.com/resharper) - [Coverity](https://www.coverity.com) - acidflash - cyberbob - cypher - Teddy Rogers - TEAM DVT - DMichael - Artic - ahmadmansoor - \_pusher\_ - firelegend - [kao](https://lifeinhex.com) - sstrato - [kobalicek](https://github.com/kobalicek) - [athre0z](https://github.com/athre0z) - [ZehMatt](https://github.com/ZehMatt) - [mrfearless](https://twitter.com/fearless0) - [JustMagic](https://github.com/JustasMasiulis) Without the help of many people and other open-source projects, it would not have been possible to make x64dbg what is it today, thank you!
Markdown
x64dbg-development/README_zh.md
# x64dbg <img width="100" src="./src/bug_black.png"/> 一个开源的Windows二进制调试器,旨在进行恶意软件分析和你没有源代码的可执行文件的逆向工程。有许多可用的功能和一个全面的插件系统 来添加你自己的功能。你可以在博客上找到更多信息! ## 屏幕截图 <!-- TODO: recreate Chinese screenshots --> ![main interface (light)](.github/screenshots/cpu-light.png) ![main interface (dark)](.github/screenshots/cpu-dark.png) | ![graph](.github/screenshots/graph-light.png) | ![memory map](.github/screenshots/memory-map-light.png) | | :--: | :--: | ## 安装与使用 1. 下载快照,并将其解压缩到您的用户具有写权限的位置。 2. _可选择_ 使用 `x96dbg.exe` 来注册一个shell扩展,并在桌面上添加快捷方式。 3. 如果你想调试一个32位的可执行文件,你现在可以运行 `x32\x32dbg.exe` 或者 `x64\x64dbg.exe`来调试一个64位的可执行文件。如果你不确定,你可以随时运行 `x96dbg.exe` 并在那里选择你的架构。 你也可以通过几个简单的步骤 自己编译 x64dbg! ## 贡献 这是一个社区的努力,我们接受拉取请求! 更多信息请参见 CONTRIBUTING 文档。如果你有任何问题,你可以随时联系我们 或提交一个问题. 你可以看一下 容易解决的问题 以开始贡献。 ## 制作人员 - 调试器核心由TitanEngine社区版提供技术支持 - 反汇编引擎由 Zydis提供技术支持 - 汇编由 XEDParse 和 asmjit提供技术支持 - 导入重建由 Scylla提供技术支持 - JSON由 Jansson提供技术支持 - 数据库优化由 lz4提供技术支持 - Bug 图标由 VisualPharm设计 - 界面图标由Fugue设计 - 网站由tr4ceflow负责 ## 开发人员 - mrexodia - Sigma - tr4ceflow - Dreg - Nukem - Herz3h - torusrxxx ## 代码贡献 你可以在这里找到一份详尽的GitHub贡献者名单. ## 特别感谢 - Sigma开发了初始图形用户界面 - 所有的捐赠者! - 每一个提交问题的人! - 我忘记添加到这个名单的人 - 博客文章作者 - EXETools 社区 - Tuts4You 社区 - ReSharper - Coverity - acidflash - cyberbob - cypher - Teddy Rogers - TEAM DVT - DMichael - Artic - ahmadmansoor - \_pusher\_ - firelegend - kao - sstrato - kobalicek - athre0z - ZehMatt 如果没有许多人和其他开源项目的帮助,就不可能使x64dbg成为今天的样子,谢谢你们!
x64dbg-development/release.bat
@echo off set RELEASEDIR=.\release rmdir /S /Q %RELEASEDIR% mkdir %RELEASEDIR% echo pluginsdk mkdir %RELEASEDIR%\pluginsdk mkdir %RELEASEDIR%\pluginsdk\dbghelp mkdir %RELEASEDIR%\pluginsdk\DeviceNameResolver mkdir %RELEASEDIR%\pluginsdk\jansson mkdir %RELEASEDIR%\pluginsdk\lz4 mkdir %RELEASEDIR%\pluginsdk\TitanEngine mkdir %RELEASEDIR%\pluginsdk\XEDParse xcopy src\dbg\dbghelp %RELEASEDIR%\pluginsdk\dbghelp /S /Y xcopy src\dbg\DeviceNameResolver %RELEASEDIR%\pluginsdk\DeviceNameResolver /S /Y xcopy src\dbg\jansson %RELEASEDIR%\pluginsdk\jansson /S /Y xcopy src\dbg\lz4 %RELEASEDIR%\pluginsdk\lz4 /S /Y xcopy src\dbg\TitanEngine %RELEASEDIR%\pluginsdk\TitanEngine /S /Y del %RELEASEDIR%\pluginsdk\TitanEngine\TitanEngine.txt /F /Q xcopy src\dbg\XEDParse %RELEASEDIR%\pluginsdk\XEDParse /S /Y copy src\dbg\_plugin_types.h %RELEASEDIR%\pluginsdk\_plugin_types.h copy src\dbg\_plugins.h %RELEASEDIR%\pluginsdk\_plugins.h copy src\dbg\_scriptapi*.h %RELEASEDIR%\pluginsdk\_scriptapi*.h copy src\dbg\_dbgfunctions.h %RELEASEDIR%\pluginsdk\_dbgfunctions.h copy src\bridge\bridge*.h %RELEASEDIR%\pluginsdk\bridge*.h genlib bin\x32\x32bridge.dll copy x32bridge.a %RELEASEDIR%\pluginsdk\libx32bridge.a del x32bridge.def del x32bridge.a copy bin\x32\x32bridge.lib %RELEASEDIR%\pluginsdk\x32bridge.lib genlib bin\x32\x32dbg.dll copy x32dbg.a %RELEASEDIR%\pluginsdk\libx32dbg.a del x32dbg.def del x32dbg.a copy bin\x32\x32dbg.lib %RELEASEDIR%\pluginsdk\x32dbg.lib genlib bin\x64\x64bridge.dll copy x64bridge.a %RELEASEDIR%\pluginsdk\libx64bridge.a del x64bridge.def del x64bridge.a copy bin\x64\x64bridge.lib %RELEASEDIR%\pluginsdk\x64bridge.lib genlib bin\x64\x64dbg.dll copy x64dbg.a %RELEASEDIR%\pluginsdk\libx64dbg.a del x64dbg.def del x64dbg.a copy bin\x64\x64dbg.lib %RELEASEDIR%\pluginsdk\x64dbg.lib echo release mkdir %RELEASEDIR%\release mkdir %RELEASEDIR%\release\translations mkdir %RELEASEDIR%\release\x32 mkdir %RELEASEDIR%\release\x64 xcopy deps\x32 %RELEASEDIR%\release\x32 /S /Y xcopy deps\x64 %RELEASEDIR%\release\x64 /S /Y xcopy bin\themes %RELEASEDIR%\release\themes /S /Y /I copy help\x64dbg.chm %RELEASEDIR%\release\ copy bin\x96dbg.exe %RELEASEDIR%\release\ copy bin\mnemdb.json %RELEASEDIR%\release\ copy bin\errordb.txt %RELEASEDIR%\release\ copy bin\exceptiondb.txt %RELEASEDIR%\release\ copy bin\ntstatusdb.txt %RELEASEDIR%\release\ copy bin\winconstants.txt %RELEASEDIR%\release\ xcopy src\gui\Translations\*.qm %RELEASEDIR%\release\translations /S /Y copy bin\x32\x32bridge.dll %RELEASEDIR%\release\x32\ copy bin\x32\x32dbg.dll %RELEASEDIR%\release\x32\ copy bin\x32\x32dbg.exe %RELEASEDIR%\release\x32\ copy bin\x32\x32dbg.exe %RELEASEDIR%\release\x32\x32dbg-unsigned.exe copy bin\x32\x32gui.dll %RELEASEDIR%\release\x32\ copy bin\x32\loaddll.exe %RELEASEDIR%\release\x32\ copy bin\x64\x64bridge.dll %RELEASEDIR%\release\x64\ copy bin\x64\x64dbg.dll %RELEASEDIR%\release\x64\ copy bin\x64\x64dbg.exe %RELEASEDIR%\release\x64\ copy bin\x64\x64dbg.exe %RELEASEDIR%\release\x64\x64dbg-unsigned.exe copy bin\x64\x64gui.dll %RELEASEDIR%\release\x64\ copy bin\x64\loaddll.exe %RELEASEDIR%\release\x64\ echo "creating commithash.txt" git rev-parse HEAD > %RELEASEDIR%\commithash.txt echo "copying PDB files" mkdir %RELEASEDIR%\pdb mkdir %RELEASEDIR%\pdb\x32 mkdir %RELEASEDIR%\pdb\x64 copy bin\*.pdb %RELEASEDIR%\pdb\ copy bin\x32\*.pdb %RELEASEDIR%\pdb\x32\ copy bin\x64\*.pdb %RELEASEDIR%\pdb\x64\ exit 0
x64dbg-development/setenv.bat
@echo off if "%OLDPATH%"=="" set OLDPATH=%PATH% if "%QT32PATH%"=="" set QT32PATH=c:\Qt\qt-5.6.2-x86-msvc2013\5.6\msvc2013\bin if "%QT64PATH%"=="" set QT64PATH=c:\Qt\qt-5.6.2-x64-msvc2013\5.6\msvc2013_64\bin if "%QTCREATORPATH%"=="" set QTCREATORPATH=c:\Qt\qtcreator-4.3.1\bin if "%VSVARSALLPATH%"=="" set VSVARSALLPATH=c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat if "%COVERITYPATH%"=="" set COVERITYPATH=c:\coverity\bin if "%1"=="x32" ( goto x32 ) else if "%1"=="x64" ( goto x64 ) else if "%1"=="coverity" ( goto coverity ) else ( echo "Usage: setenv x32/x64/coverity" goto :eof ) :x32 echo Setting Qt in PATH set PATH=%PATH%;%QT32PATH% set PATH=%PATH%;%QTCREATORPATH% echo Setting VS in PATH call "%VSVARSALLPATH%" goto :eof :x64 echo Setting Qt in PATH set PATH=%PATH%;%QT64PATH% set PATH=%PATH%;%QTCREATORPATH% echo Setting VS in PATH call "%VSVARSALLPATH%" amd64 goto :eof :coverity echo Setting Coverity in PATH set PATH=%PATH%;%COVERITYPATH% goto :eof