<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>x83.net &#187; bash</title>
	<atom:link href="http://www.x83.net/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.x83.net</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 13:53:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Script to generate /etc/network/interfaces file on Ubuntu/Debian</title>
		<link>http://www.x83.net/script-to-generate-etcnetworkinterfaces-file-on-ubuntudebian/</link>
		<comments>http://www.x83.net/script-to-generate-etcnetworkinterfaces-file-on-ubuntudebian/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 18:37:04 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[/etc/network/interfaces/debian]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[generate]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://www.x83.net/?p=386</guid>
		<description><![CDATA[#!/bin/bash ifile=/etc/network/interfaces echo -n &#8220;Insert IPstart:&#8221; read ipstart echo -n &#8220;Insert IPend:&#8221; read ipend echo -n &#8220;Insert Gateway:&#8221; read gw #echo -n &#8220;Insert Subnet: &#8221; #read subnet echo -n &#8220;Insert Netmask: &#8221; read net echo -n &#8220;Insert aliast to start: &#8221; read ali firstIp=`echo &#8220;${ipstart%.*}&#8221;` lastIpStart=`echo &#8220;${ipstart##*.}&#8221;` lastIpEnd=`echo &#8220;${ipend##*.}&#8221;` dif=`echo $(($lastIpEnd-$lastIpStart))` ip=$lastIpStart for ((i=$ali;i>$ifile echo [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>#!/bin/bash<br />
ifile=/etc/network/interfaces<br />
echo -n &#8220;Insert IPstart:&#8221;<br />
read ipstart<br />
echo -n &#8220;Insert IPend:&#8221;<br />
read ipend<br />
echo -n &#8220;Insert Gateway:&#8221;<br />
read gw<br />
#echo -n &#8220;Insert Subnet: &#8221;<br />
#read subnet<br />
echo -n &#8220;Insert Netmask: &#8221;<br />
read net<br />
echo -n &#8220;Insert aliast to start: &#8221;<br />
read ali</p>
<p>firstIp=`echo &#8220;${ipstart%.*}&#8221;`<br />
lastIpStart=`echo &#8220;${ipstart##*.}&#8221;`<br />
lastIpEnd=`echo &#8220;${ipend##*.}&#8221;`<br />
dif=`echo $(($lastIpEnd-$lastIpStart))`</p>
<p>ip=$lastIpStart<br />
for ((i=$ali;i<=$ali+$dif;i++)){<br />
echo "auto eth0:$i" >>$ifile<br />
echo &#8220;iface eth0:$i inet static&#8221; >>$ifile<br />
echo &#8220;address $firstIp.$ip&#8221; >>$ifile<br />
echo &#8220;network $subnet&#8221; >>$ifile<br />
echo &#8220;netmask $net&#8221; >>$ifile<br />
echo &#8220;gateway $gw&#8221; >> $ifile<br />
echo &#8221; &#8221; >> $ifile<br />
let ip++<br />
}
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/script-to-generate-etcnetworkinterfaces-file-on-ubuntudebian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script to generate interface configs on Linux</title>
		<link>http://www.x83.net/script-to-generate-interface-configs-on-linux/</link>
		<comments>http://www.x83.net/script-to-generate-interface-configs-on-linux/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 20:26:54 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Redhat]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[DEVICE]]></category>
		<category><![CDATA[gateway]]></category>
		<category><![CDATA[ifcfg-eth1]]></category>
		<category><![CDATA[IPADDR]]></category>
		<category><![CDATA[touch]]></category>

		<guid isPermaLink="false">http://www.x83.net/?p=382</guid>
		<description><![CDATA[Generate ifcfg-eth1 307-366 configs. touch ifcfg-eth1:{307..366} for f in ifcfg-eth1:{307..366}; do cat origfile > &#8220;$f&#8221;; done for f in eth1:{307..366}; do echo &#8220;DEVICE=$f&#8221; >> &#8220;ifcfg-$f&#8221;; done for f in {307..366}; do echo &#8220;IPADDR=aaa.bbb.ccc.$((f-239))&#8221; >> &#8220;ifcfg-eth1:$f&#8221;; done origfile contains: GATEWAY=eee.fff.ggg.hhh TYPE=Ethernet BOOTPROTO=none NETMASK=255.255.255.192]]></description>
			<content:encoded><![CDATA[<p>Generate ifcfg-eth1 307-366 configs. </p>
<blockquote><p>touch ifcfg-eth1:{307..366}<br />
for f in ifcfg-eth1:{307..366}; do cat origfile > &#8220;$f&#8221;; done<br />
for f in eth1:{307..366}; do echo &#8220;DEVICE=$f&#8221; >> &#8220;ifcfg-$f&#8221;; done<br />
for f in {307..366}; do echo &#8220;IPADDR=aaa.bbb.ccc.$((f-239))&#8221; >> &#8220;ifcfg-eth1:$f&#8221;; done
</p></blockquote>
<p>origfile contains:</p>
<blockquote><p>GATEWAY=eee.fff.ggg.hhh<br />
TYPE=Ethernet<br />
BOOTPROTO=none<br />
NETMASK=255.255.255.192</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/script-to-generate-interface-configs-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash commands</title>
		<link>http://www.x83.net/bash-commands/</link>
		<comments>http://www.x83.net/bash-commands/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 08:48:26 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://www.x83.net/?p=322</guid>
		<description><![CDATA[export LINES=57; export COLUMNS=157; resize eval $(tset -s xterm; resize; alias ll=&#8221;ls -Al&#8221;) ps -e -ww -o user,pid,ppid,pcpu,pmem,size:7=Swap,lstart,args=Command &#8211;sort=-rss]]></description>
			<content:encoded><![CDATA[<p>export LINES=57; export COLUMNS=157; resize</p>
<p>eval $(tset -s xterm; resize; alias ll=&#8221;ls -Al&#8221;)</p>
<p>ps -e -ww -o user,pid,ppid,pcpu,pmem,size:7=Swap,lstart,args=Command &#8211;sort=-rss</p>
]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/bash-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to remove malware, iframe virus from your site</title>
		<link>http://www.x83.net/how-to-remove-malware-iframe-virus-from-your-site/</link>
		<comments>http://www.x83.net/how-to-remove-malware-iframe-virus-from-your-site/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 17:25:13 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">http://www.x83.net/?p=315</guid>
		<description><![CDATA[I guess many of you already have this issue regarding the iframe malware. In my researches I found out that this isn’t the hosting Linux/Windows server fault. This issue is provoked by a Windows Virus that sniffs the internet connection for user names and passwords of ftp accounts. Then it silently download every (or only [...]]]></description>
			<content:encoded><![CDATA[<p>I guess many of you already have this issue regarding the iframe malware.</p>
<p>In my researches I found out that this isn’t the hosting Linux/Windows server fault. This issue is provoked by a Windows Virus that sniffs the internet connection for user names and passwords of ftp accounts. Then it silently download every (or only index/default) files from the remote ftp to the infected Windows PC and then adds the iframe or javascript code and in the end it uploads back the files. So..first of all when removing this virus from the remote servers check your computers. The virus is known as : Trojan.Script.Iframe.</p>
<p>After scanning your system carefully, consider to stop using FTP. Download WinSCP and stop storing your passwords locally. Then change your passwords.</p>
<p>To get the list of infected files I use either grep or find under any Shell prompt (you will need ssh access to the server):</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">grep -Z -R &quot;income&quot; *
101/index.html</pre></div></div>

<p>or with find:</p>
<blockquote><p>find $PWD \( -name &#8220;*.php&#8221; -o -name &#8220;*.html&#8221; -o -iname &#8220;*.htm&#8221; \) -exec grep -l &#8220;income&#8221; {} \;</p></blockquote>
<p>Also you can check the timestamp of the files and if you see changes of index.html or any other file and you did not do that on purpose then it means you are infected. I`m using the -mtime paramter of find to check for infected files:</p>
<blockquote><p>find . -mtime -2</p></blockquote>
<p>Will search all files that were modified in the last 48 hours</p>
<p>Malware Removal<br />
You can remove the malware by just deleting the code (sample above) on the affected files. If you need to cleanup hundred of infected files you can do the following:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">perl -pi -e 's/(\)&amp;lt;/pre&amp;gt;
&amp;lt;p&amp;gt;Conclusion:&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;How the hack is done?&amp;lt;br /&amp;gt;
   1. Client side PC gets infected with the virus from the search results.&amp;lt;br /&amp;gt;
   2. Virus gets FTP username/password from the FTP clients.&amp;lt;br /&amp;gt;
   3. Using the username/password, the virus then downloads the index files, adds the iframe code in it and re-uploads it to the web server.&amp;lt;br /&amp;gt;
   4. The iframe code points to the same virus. So, anyone accessing this website gets infected with the same virus, and it spreads again!!!!&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;# Solutions&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;   1. Ensure that your code is free from such kind of vulnerabilities.&amp;lt;br /&amp;gt;
   2. Change all the FTP passwords regularly and keep them safe and use a combination of alphabets + numbers + special characters.&amp;lt;br /&amp;gt;
   3. Before updating the new password in their FTP clients, perform a full system Virus scan with a reliable virus scanner updated with the latest virus definition files.&amp;lt;br /&amp;gt;
   4. Also try not to save (remember) the FTP username/password on FTP clients or public computers.&amp;lt;br /&amp;gt;
   5. Check the website files for any unrecognizable or encrypted codes that are not known to you or is not a part of the website’s function. If found then please follow the above mentioned steps and update the web pages with the proper codes.&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Update : In august 2009 I`ve found that even .htaccess files can contain some redirection to malware sites. The bad part is that if you are using FTP not every time you see the .htaccess file because its hidden. &amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Also..to check if your site contains the iframe virus you can use the Tamper Data plugin with Firefox and while you are browsing your site you can notice &quot;strange&quot; links redirections in Tamper data.&amp;lt;/p&amp;gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/how-to-remove-malware-iframe-virus-from-your-site/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Squid and password authentication</title>
		<link>http://www.x83.net/squid-and-password-authentication/</link>
		<comments>http://www.x83.net/squid-and-password-authentication/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 09:00:53 +0000</pubDate>
		<dc:creator>Giany</dc:creator>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Redhat]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[acl]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[generate]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[tcp_outgoing_address]]></category>
		<category><![CDATA[visible_hostname]]></category>

		<guid isPermaLink="false">http://www.x83.net/?p=274</guid>
		<description><![CDATA[yum install squid Example of squid.conf http_port 10000 hierarchy_stoplist cgi-bin ? acl QUERY urlpath_regex cgi-bin \? no_cache deny QUERY auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours auth_param basic casesensitive off refresh_pattern ^ftp: 1440 20% 10080 refresh_pattern ^gopher: 1440 0% 1440 refresh_pattern [...]]]></description>
			<content:encoded><![CDATA[<p>yum install squid</p>
<p>Example of squid.conf</p>
<blockquote><p>http_port 10000<br />
hierarchy_stoplist cgi-bin ?</p>
<p>acl QUERY urlpath_regex cgi-bin \?<br />
no_cache deny QUERY</p>
<p>auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd<br />
auth_param basic children 5<br />
auth_param basic realm Squid proxy-caching web server<br />
auth_param basic credentialsttl 2 hours<br />
auth_param basic casesensitive off</p>
<p>refresh_pattern ^ftp:           1440    20%     10080<br />
refresh_pattern ^gopher:        1440    0%      1440<br />
refresh_pattern .               0       20%     4320</p>
<p>acl all src 0.0.0.0/0.0.0.0<br />
acl SSL_ports port 443 563<br />
acl Safe_ports port 80          # http<br />
acl Safe_ports port 21          # ftp<br />
acl Safe_ports port 443 563     # https, snews<br />
acl Safe_ports port 70          # gopher<br />
acl Safe_ports port 210         # wais<br />
acl Safe_ports port 1025-65535  # unregistered ports<br />
acl Safe_ports port 280         # http-mgmt<br />
acl Safe_ports port 488         # gss-http<br />
acl Safe_ports port 591         # filemaker<br />
acl Safe_ports port 777         # multiling http</p>
<p>acl ncsa_users proxy_auth REQUIRED<br />
http_access deny !Safe_ports<br />
http_access allow ncsa_users<br />
visible_hostname mysite.com<br />
coredump_dir /var/spool/squid</p></blockquote>
<blockquote><p>service squid start</p></blockquote>
<p>Setting proxy for wget:</p>
<blockquote><p>export http_proxy=http://anton:testinsg@mysite:10000</p></blockquote>
<p>If you want to make it anonymous add these lines:</p>
<blockquote><p>forwarded_for off</p>
<p>header_access Allow allow all<br />
header_access Authorization allow all<br />
header_access WWW-Authenticate allow all<br />
header_access Proxy-Authorization allow all<br />
header_access Proxy-Authenticate allow all<br />
header_access Cache-Control allow all<br />
header_access Content-Encoding allow all<br />
header_access Content-Length allow all<br />
header_access Content-Type allow all<br />
header_access Date allow all<br />
header_access Expires allow all<br />
header_access Host allow all<br />
header_access If-Modified-Since allow all<br />
header_access Last-Modified allow all<br />
header_access Location allow all<br />
header_access Pragma allow all<br />
header_access Accept allow all<br />
header_access Accept-Charset allow all<br />
header_access Accept-Encoding allow all<br />
header_access Accept-Language allow all<br />
header_access Content-Language allow all<br />
header_access Mime-Version allow all<br />
header_access Retry-After allow all<br />
header_access Title allow all<br />
header_access Connection allow all<br />
header_access Proxy-Connection allow all<br />
header_access Cookie allow all<br />
header_access Set-Cookie allow all<br />
header_access All deny all</p>
<p>acl ip4 myaclname yourip<br />
tcp_outgoing_address yourip myaclname</p></blockquote>
<p>Generate acl and tcp_outgoing_address:</p>
<blockquote><p>for f in {314..372}; do echo &#8220;acl ip$((f))&#8221; myip aaa.bbb.ccc.$((f-246)) >> &#8220;blah1&#8243;; done<br />
for f in {314..372}; do echo &#8220;tcp_outgoing_address aaa.bbb.ccc.$((f-246))&#8221; ip$((f)) >> &#8220;blah1&#8243;; done</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.x83.net/squid-and-password-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

