<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://etcwiki.org/index.php?action=history&amp;feed=atom&amp;title=Log_failed_passwords_to_a_file_in_Wordpress</id>
	<title>Log failed passwords to a file in Wordpress - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://etcwiki.org/index.php?action=history&amp;feed=atom&amp;title=Log_failed_passwords_to_a_file_in_Wordpress"/>
	<link rel="alternate" type="text/html" href="http://etcwiki.org/index.php?title=Log_failed_passwords_to_a_file_in_Wordpress&amp;action=history"/>
	<updated>2026-05-12T17:42:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://etcwiki.org/index.php?title=Log_failed_passwords_to_a_file_in_Wordpress&amp;diff=3915&amp;oldid=prev</id>
		<title>Ddxfish at 16:02, 21 January 2018</title>
		<link rel="alternate" type="text/html" href="http://etcwiki.org/index.php?title=Log_failed_passwords_to_a_file_in_Wordpress&amp;diff=3915&amp;oldid=prev"/>
		<updated>2018-01-21T16:02:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:02, 21 January 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l35&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[http://www.angelwatt.com/words/2012/04/03/wordpress-plugin-log-login-attempts/ Angel Watt - log login attempts] - this is more thorough, with CSV output, but seemed like overkill to me, and was more than a few years old&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[http://www.angelwatt.com/words/2012/04/03/wordpress-plugin-log-login-attempts/ Angel Watt - log login attempts] - this is more thorough, with CSV output, but seemed like overkill to me, and was more than a few years old&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[https://stackoverflow.com/questions/33709837/how-to-log-login-attempts-directly-on-a-log-file Stack Overflow] - Just people searching for this same stuff, no solutions&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*[https://stackoverflow.com/questions/33709837/how-to-log-login-attempts-directly-on-a-log-file Stack Overflow] - Just people searching for this same stuff, no solutions&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Wordpress]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ddxfish</name></author>
	</entry>
	<entry>
		<id>http://etcwiki.org/index.php?title=Log_failed_passwords_to_a_file_in_Wordpress&amp;diff=3914&amp;oldid=prev</id>
		<title>Ddxfish: Created page with &quot;One of my Wordpress sites was getting hacked and I was wondering what passwords the hackers were attempting to use so we could know how serious it was. I added this snippet of...&quot;</title>
		<link rel="alternate" type="text/html" href="http://etcwiki.org/index.php?title=Log_failed_passwords_to_a_file_in_Wordpress&amp;diff=3914&amp;oldid=prev"/>
		<updated>2018-01-21T16:01:53Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;One of my Wordpress sites was getting hacked and I was wondering what passwords the hackers were attempting to use so we could know how serious it was. I added this snippet of...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;One of my Wordpress sites was getting hacked and I was wondering what passwords the hackers were attempting to use so we could know how serious it was. I added this snippet of code to the end of my &amp;#039;&amp;#039;&amp;#039;functions.php&amp;#039;&amp;#039;&amp;#039; file in Wordpress. This code hooks into wp_login_failed, so it will only record failed passwords to the file. You have to modify one line to link to your website&amp;#039;s root directory.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Yeah I know this code could be done in fewer lines and with better output logging. Oh well, it works.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Wordpress 4.9.2  -- Written 1/21/2018&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
==Dangers==&lt;br /&gt;
*If you mistype your password by 1 letter it will be logged!&lt;br /&gt;
*Writing to a hidden file like .htfailures will make it more secure, do not write to a CSV or something that ends up public!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 //RECORD FAILED PASSWORDS TO A FILE goes in functions.php&lt;br /&gt;
 add_action(&amp;#039;wp_login_failed&amp;#039;, &amp;#039;login_failed_func&amp;#039;);&lt;br /&gt;
 function login_failed_func($args) {&lt;br /&gt;
         //Start output buffering to avoid echoing&lt;br /&gt;
         ob_start();&lt;br /&gt;
         $data = var_dump($args);&lt;br /&gt;
         $out = ob_get_clean();&lt;br /&gt;
         $failed = $_POST[&amp;#039;pwd&amp;#039;];&lt;br /&gt;
         $date = date(&amp;#039;m/d/Y h:i:s a&amp;#039;);&lt;br /&gt;
         //REPLACE THIS FILE WITH YOUR FILE&lt;br /&gt;
         $my_file = &amp;#039;/var/www/mysite/public_html/.htfailures&amp;#039;;&lt;br /&gt;
         $handle = fopen($my_file, &amp;#039;a&amp;#039;) or die(&amp;#039;Cannot open file:  &amp;#039;.$my_file);&lt;br /&gt;
         $newline = &amp;quot;\n&amp;quot;;&lt;br /&gt;
         fwrite($handle, $date);&lt;br /&gt;
         fwrite($handle, $out);&lt;br /&gt;
         fwrite($handle, $failed);&lt;br /&gt;
         fwrite($handle, $newline);&lt;br /&gt;
         fwrite($handle, $newline);&lt;br /&gt;
         fclose($handle);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
*[https://stackoverflow.com/questions/4376647/is-there-a-way-to-get-the-password-on-a-failed-wordpress-login StackOverflow - Is there a way to get the password on a failed wordpress login?]&lt;br /&gt;
*[http://www.angelwatt.com/words/2012/04/03/wordpress-plugin-log-login-attempts/ Angel Watt - log login attempts] - this is more thorough, with CSV output, but seemed like overkill to me, and was more than a few years old&lt;br /&gt;
*[https://stackoverflow.com/questions/33709837/how-to-log-login-attempts-directly-on-a-log-file Stack Overflow] - Just people searching for this same stuff, no solutions&lt;/div&gt;</summary>
		<author><name>Ddxfish</name></author>
	</entry>
</feed>