<?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>yurisk.info &#187; Awk weekly</title>
	<atom:link href="http://yurisk.info/category/awk-weekly/feed/" rel="self" type="application/rss+xml" />
	<link>http://yurisk.info</link>
	<description>Yuri Slobodyanyuk&#039;s blog on IT Security and Networking</description>
	<lastBuildDate>Mon, 16 Apr 2012 17:23:20 +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>Check duplex and speed settings of all interfaces in one go</title>
		<link>http://yurisk.info/2012/02/16/check-duplex-and-speed-settings-of-all-interfaces-in-one-go/</link>
		<comments>http://yurisk.info/2012/02/16/check-duplex-and-speed-settings-of-all-interfaces-in-one-go/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 18:36:39 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Checkpoint]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1834</guid>
		<description><![CDATA[One of the first things you do when checking connectivity issues on the Checkpoint (or any networking gear for that matter) is to see speed and duplex parameters of the interfaces. But have you tried to do it on a firewall with 15-20 interfaces ? No fun entering one by one interfaces&#8217; names. Here is [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first things you do when checking connectivity issues on the Checkpoint (or any networking gear for that matter) is to see speed and duplex parameters of the interfaces. But have you tried to do it on a firewall with 15-20 interfaces ?<br />
No fun entering one by one interfaces&#8217; names. Here is the one-liner I use to get speed and duplex settings of all interfaces in one go.</p>
<p>#<strong> for ii in $(ifconfig | awk &#8216;/Ethernet/ {print $1}&#8217;) ;do ethtool $ii; done | egrep  &#8216;eth|Speed|Duplex&#8217; </strong><br />
Settings for eth0:<br />
Speed: 100Mb/s<br />
Duplex: Full<br />
Settings for eth1:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth1.150:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth1.160:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth1.161:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth1.270:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth1.271:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
<span id="more-1834"></span><br />
Settings for eth1.281:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth1.35:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth2:<br />
Speed: 100Mb/s<br />
Duplex: Full<br />
Settings for eth3:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.112:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.211:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.311:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.71:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.72:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.73:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.413:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.419:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.451:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.407:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth4.408:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth5:<br />
Speed: 1000Mb/s<br />
Duplex: Full<br />
Settings for eth7:<br />
Speed: 1000Mb/s<br />
Duplex: Full</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2012/02/16/check-duplex-and-speed-settings-of-all-interfaces-in-one-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>awk weekly &#8211; Security rule hits statistics . Checkpoint</title>
		<link>http://yurisk.info/2012/01/31/awk-weekly-rule-hits-statistics-checkpoint/</link>
		<comments>http://yurisk.info/2012/01/31/awk-weekly-rule-hits-statistics-checkpoint/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 08:50:36 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=572</guid>
		<description><![CDATA[As I mentioned before once you export firewall logs into human-readable format you can do lots of interesting things &#8211; for example script that gives statistics of how many times each Security rule was hit . Be aware that this counts explicit Security rules only &#8211; i.e. the ones you see in Security tab of [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned before once you export firewall logs into human-readable format you can do lots of interesting things &#8211; for example script that gives statistics of how many times each Security rule was hit .<br />
Be aware that this counts explicit Security rules only &#8211; i.e. the ones you see in Security tab of the Smartdashboard. No other rules you usually see in Smartview Tracker are counted &#8211; e.g. SmartDefense,Web Filtering etc. Also afterwards I sort it by number of hits to see what rules are used most:</p>
<div class="cmd">awk -F\;  &#39; {match($0,/rule: +([0-9]+)/,rules);rule_count[rules[1]]++} END {for (rule_number in rule_count) print &quot; Rule number: &quot;  rule_number &quot; Hits: &quot; rule_count[rule_number]}&#39; ./fw.log.txt | sort -n -k5 </div>
<pre>
Rule number:  Hits: 1197330 <strong> Ignore this line as it counts non-matched lines I dont want to filter with additional conditions and added time processing</strong>
 Rule number: 2 Hits: 9
 Rule number: 5 Hits: 366
 Rule number: 11 Hits: 12296
 Rule number: 9 Hits: 14457
 Rule number: 0 Hits: 17094
 Rule number: 1 Hits: 44066
 Rule number: 7 Hits: 233643
 Rule number: 10 Hits: 366275
 Rule number: 6 Hits: 424639 </pre>
<div class="portant"><strong> Update 2012 </strong> Below is the script to use Rule ID instead of Rule sequential numbers &#8211; this way changing rules order will not affect statistics.  The script matches also non-security rules &#8211; e.g. email session id, that are a bit shorter then Rule ID, but I didn&#8217;t want to slow down the processing with additional formatting .
</div>
<div class="cmd">
awk -F\;  &#39; {match($0,/{([[:print:]]+)}/,rules);rule_count[rules[1]]++} END {for (rule_number in rule_count) print &quot; Rule number: &quot;  rule_number &quot; Hits: &quot; rule_count[rule_number]}&#39; ./fw.log.txt | sort -n -k5 </div>
<pre>
Rule number: D199972C-ED3E-4EB4-8B83-813333156D18 Hits: 175
 Rule number: 85A905A7-951E-4100-A4BA-E13333151D29 Hits: 219
 Rule number: 81333316-E942-4313-BB7D-E1333315802F Hits: 1519
 Rule number: 71333215-2DB5-4A3A-95BC-5080AD0F5564 Hits: 2298
 Rule number: 11331315-AE52-44E0-A42A-711029B5768E Hits: 3755
 Rule number: 01333315-D290-4B05-AFE7-23BF24D889FF Hits: 4116
 Rule number: 121FA62F-3885-4328-8090-BF1333315eB1 Hits: 399793
 Rule number: FE40E076-BAEB-4979-8E41-5EF1333315e6 Hits: 440101
 Rule number: BB3F6772-4D38-4D5A-952A-301333315de8 Hits: 1354341
Running time for a file of 900 Mb with 4.7 million records
real    5m50.287s
user    4m22.890s
sys     0m3.190s
</pre>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2012/01/31/awk-weekly-rule-hits-statistics-checkpoint/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>IP address pools of Facebook to block, if you need to</title>
		<link>http://yurisk.info/2010/11/15/ip-address-pools-of-facebook/</link>
		<comments>http://yurisk.info/2010/11/15/ip-address-pools-of-facebook/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 12:14:15 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Scan of the week]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1421</guid>
		<description><![CDATA[Once upon a time I mentioned that blocking Facebook is easy as they have a uniform IP addresses pool . Since then they added more , here is the new and old pools: NetRange: 69.63.176.0 &#8211; 69.63.191.255 CIDR: 69.63.176.0/20 OriginAS: AS32934 NetName: TFBNET2 NetHandle: NET-69-63-176-0-1 Parent: NET-69-0-0-0-0 NetType: Direct Assignment NameServer: NS5.FACEBOOK.COM NameServer: NS3.FACEBOOK.COM NameServer: [...]]]></description>
			<content:encoded><![CDATA[<p>Once upon a time I <a href="http://yurisk.info/2009/04/09/black-hole-routing-to-the-rescue-fortigate-os-4-surprise/" >mentioned</a> that blocking Facebook is easy as they have a uniform IP addresses pool . Since then they added more , here is the new and old pools:</p>
<div class="cmdout">
NetRange:       69.63.176.0 &#8211; 69.63.191.255<br />
CIDR:           69.63.176.0/20<br />
OriginAS:       AS32934<br />
NetName:        TFBNET2<br />
NetHandle:      NET-69-63-176-0-1<br />
Parent:         NET-69-0-0-0-0<br />
NetType:        Direct Assignment<br />
NameServer:     NS5.FACEBOOK.COM<br />
NameServer:     NS3.FACEBOOK.COM<br />
NameServer:     NS4.FACEBOOK.COM<br />
RegDate:        2007-02-07<br />
Updated:        2010-07-08</div>
<div class="cmdout">
NetRange:       66.220.144.0 &#8211; 66.220.159.255<br />
CIDR:           66.220.144.0/20<br />
OriginAS:       AS32934<br />
NetName:        TFBNET3<br />
NetHandle:      NET-66-220-144-0-1<br />
Parent:         NET-66-0-0-0-0<br />
NetType:        Direct Assignment<br />
NameServer:     NS5.FACEBOOK.COM <br />
NameServer:     NS3.FACEBOOK.COM  <br />
NameServer:     NS4.FACEBOOK.COM <br />
RegDate:        2009-02-13</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/11/15/ip-address-pools-of-facebook/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>See what your users are doing &#8211; awk one-line scripts to parse eSafe logs</title>
		<link>http://yurisk.info/2010/10/19/see-what-your-users-are-doing-awk-one-line-scripts-to-parse-esafe-logs/</link>
		<comments>http://yurisk.info/2010/10/19/see-what-your-users-are-doing-awk-one-line-scripts-to-parse-esafe-logs/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 20:49:46 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Esafe]]></category>
		<category><![CDATA[awk weekly]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1283</guid>
		<description><![CDATA[As most of the posts here this one is also inspired by a client. There was an unassuming shy and not making any troubles eSafe 8.5 appliance XG-200. Then one day Security Admin of the company complained to me about &#8216;high CPU utilization&#8217; &#8211; getting somewhere up to 60% . eSafe looked absolutely fine and [...]]]></description>
			<content:encoded><![CDATA[<p>As most of the posts here this one is also inspired by a client. There was an unassuming shy and not making any troubles <a href="http://aladdin.com" target="_blank">eSafe 8.5 </a>appliance XG-200. Then one day Security Admin of the company complained to me about &#8216;high CPU utilization&#8217; &#8211; getting somewhere up to 60% . eSafe looked absolutely fine and doing its work.<br />
Also I noticed it was kinda working hard , nothing special but just general feeling that it handles a lot of load. And boy was I right &#8211; it was doing 200 Mb of logs per day . Given the number of stations in LAN and working hours that was huge. I looked with awk at the logs and happily updated the SecAdmin that eSafe is doing its work and blocks all the users trying frantically to visit various porno sites ignoring the &#8220;Site is blocked ..&#8221;message by the eSafe.  &#8220;What?  my users to pron sites, can&#8217;t be, can you show me the logs, who does it ?&#8221; . No problem, and so the awk one-liners  you see below were written to parse esafe Aladdin logs to get some insight. Also at the end of the post see eSafe log format in case you want to develop your own scripts.<br />
All logs are located at /opt/eSafe/eSafeCR/SessionLog/<br />
One-liner number one &#8211; Gather IPs that sent spam , count number of spam messages per IP, sort the list in ascending order .</p>
<div class="cmd"># awk -F&quot;|&quot; &#39;$4~SMTP &amp;&amp; ( $6~/Spam blocked/ || $6~/Mail rejected/ ) { print $11} &#39;    *.log  | sort -n | uniq -c | sort -n | tail -10</div>
<div class="cmdout">29 80.179.60.37<br />
32 41.59.0.205<br />
41 74.63.80.6<br />
41 83.16.167.14<br />
48 125.163.188.31<br />
54 125.163.192.184<br />
57 113.168.9.224<br />
78 89.223.56.16<br />
80 212.143.70.26<br />
104 212.143.70.27</div>
<p>One-liner number two – Mail sender fileds of spam messages , just for fun , no real value for security purpose:</p>
<div class="cmd"># awk -F&quot;|&quot; &#39; $4~SMTP &amp;&amp; ( $6~/Spam blocked/ || $6~/Mail rejected/ ) { print $15}  &#39; *.log  | sort  | uniq -c | sort -n</div>
<div class="cmdout">8 Stephan@117.40.136.73<br />
10 bsb@bsbinfo.in<br />
13 info@all-free.co.il<br />
13 Janette@2.90.58.204<br />
15 Ronnie@178.34.19.174<br />
17 KellieClements@cramerspointmotel.com<br />
22 notifs@m.snapinteractiveapps.com<br />
60 ezrachmudag26@gmail.com<br />
25 Simone@187.63.223.21<br />
102 Angelo@31.subnet125-163-188.speedy.telkom.net.id</div>
<p>One-liner to see all the blocks/rejects reasons and respective statistics.</p>
<div class="cmd"># awk -F&quot;|&quot;&#39; {print $6}&#39; *.log | sort -k1,1 | uniq -c</div>
<div class="cmdout">8 Application blocked<br />
21967 File allowed<br />
360 File blocked<br />
114891 File clean<br />
1731 File modified to remove malicious content<br />
3650 Mail clean<br />
111 Mail modified to remove malicious content<br />
13 Mail rejected  #912 &#8211; Anti-spoofing &#8211; Mail rejected. Attempt to impersonate a local user<br />
164 SMTP error<br />
803 Spam blocked</div>
<p><strong>Now let&#8217;s move to HTTP browsing.</strong><br />
One-liner number four – blocked access to websites : number of blocked attempts per website, hostname of the website,  internal LAN IP of PC that tried to access the resource.<br />
I do not bring examples here as they are quite embarrassing, even to be brought anonymously, so just trust me – run it on your esafe and you will blush.</p>
<div class="cmd"># awk -F&quot;|&quot; &#39;$4~HTTP &amp;&amp;  /File blocked/  { print $7,$17} &#39; *.log   | sort -k1,1 | uniq -c  | sort -n -k1,1</div>
<p>Same as above but with full path to the prohibited file.</p>
<div class="cmd"># awk -F&quot;|&quot; &#39;$4~HTTP &amp;&amp;  /File blocked/  { print $8,$17,$11}  &#39; *.log   | sort -k1,1 | uniq -c  | sort -n -k1,1</div>
<p>And finally as promised the  format of eSafe logs. All the fields in logs are separated by vertical bar (as you probably guessed awk –F&#8221;|&#8221; accounts for that). All the fields are present, while irrelevant fields are empty. So it is really scripting-friendly. I broke down the fields into separate lines with field number of each field. Enjoy.</p>
<div class="cmd">#  awk  -F&quot;|&quot; &#39; { for (i=1;i&lt;=NF;i++) print i,$i}&#39; header.txt</div>
<div class="cmdout">1 Date (yyyy-mm-dd  HH:mm:ss)<br />
2 eSafe name<br />
3 Record ID<br />
4 ProtocolType<br />
5 Method<br />
6 Event<br />
7 URL host<br />
8 File Name\Mail Subject<br />
9 File Type<br />
10 #File Size<br />
11 Source IP<br />
12 Destination IP<span id="more-1283"></span><br />
13 #VLAN<br />
14 #Port<br />
15 Mail Sender<br />
16 Mail Recipients<br />
17 URL category<br />
18 User<br />
19 LDAP domain<br />
20 Host<br />
21 Decision By<br />
22 Profile<br />
23 Policy<br />
24 #Policy ID<br />
25 Details<br />
26 Extended result<br />
27 SessionID<br />
28 MessageID<br />
29 #Rule<br />
30 #File Binary Family<br />
31 File container path<br />
32 File name<br />
33 #File parameter<br />
34 #Engine code<br />
35 #Activity code<br />
36 Blocked URL category code<br />
37 URL category mask<br />
38 Result name<br />
39 #Result code<br />
40 #Server type ID<br />
41 #Application code<br />
42 #Action<br />
43 #Risky<br />
44 #Source IP<br />
45 #Destination IP<br />
46 #MachineIP<br />
47 #Duration<br />
48 #AID<br />
49 Referrer<br />
50 UUID<br />
51 #Has CMF<br />
52 Date<br />
53 Time<br />
54 #Mail status<br />
55 DLP profile</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/10/19/see-what-your-users-are-doing-awk-one-line-scripts-to-parse-esafe-logs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Darknet can&#8217;t lie &#8211; most of the attacks, scans and other interesting things indeed come from behind the Great Firewall of China.</title>
		<link>http://yurisk.info/2010/10/12/darknet-cant-lie-most-of-the-attacks-scans-and-other-interesting-things-come-from-behind-the-great-firewall-of-china/</link>
		<comments>http://yurisk.info/2010/10/12/darknet-cant-lie-most-of-the-attacks-scans-and-other-interesting-things-come-from-behind-the-great-firewall-of-china/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 10:33:01 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Scan of the week]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1230</guid>
		<description><![CDATA[Working for ISP entitles me to various perks, one of them is unlimited connection to the Internet with wealth of unallocated yet IP addresses. So to use it somehow I set up a little Darknet (details what it means can be found here Darknet Project ) and gather some statistics. First the volume of unsolicited [...]]]></description>
			<content:encoded><![CDATA[<p>Working for <a href="http://netvision.net.il" target="_blank">ISP</a> entitles me to various perks, one of them is unlimited connection to the Internet with wealth of unallocated yet IP addresses. So to use it somehow I set up a little Darknet (details what it means can be found here <a href="http://www.team-cymru.org/Services/darknets.html"> Darknet Project </a> ) <img class="size-medium wp-image-1293 alignleft" title="Hackers_attack" src="http://yurisk.info/wp-content/uploads/2010/10/Hackers_attack2-300x199.gif" alt="Most malware comes from China" width="300" height="199" />and gather some statistics. First the volume of unsolicited and malicious traffic is staggering . Mostly it is traffic to Windows sharing &#8211; port 445 , then brute force &#8211; port 22, then strange ports used by new malware in the wild .Second, the interesting information pretty much stops here &#8211; as nothing listens on my side of the Darknet I don&#8217;t get more insight. As comes from this I am working on the next stage of the Darknet &#8211; HoneyNet. Once done, I&#8217;ll post here the findings.<br />
To give you a glimpse of the Ips and ports involved in probes here is the non-sanitized sorted list of the alien IPs , destination ports, protocols and number of packets seen.This is the day&#8217;s worth statistics <a href="http://yurisk.info/The_Darknet_probing_IPSS.txt.gz"> Bad guys and gals IPs</a><br />
To get this list from Tcpdump capture I used one-liner: <strong>[root@darkstar]# tshark -n  -r honey_bunny.cap42 | awk &#39; $3~/[0-9]+\./ {print $3,$6,$9}&#39; | sort -n -k1,1 | uniq -c &gt; Darknet_probing_IPs.txt </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/10/12/darknet-cant-lie-most-of-the-attacks-scans-and-other-interesting-things-come-from-behind-the-great-firewall-of-china/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List of valid domain names for load testing DNS</title>
		<link>http://yurisk.info/2010/08/14/list-of-valid-domain-names/</link>
		<comments>http://yurisk.info/2010/08/14/list-of-valid-domain-names/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 09:45:19 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scan of the week]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=1032</guid>
		<description><![CDATA[I am currently running a bunch of tests on DNS resolver software called Unbound to see what it is worth and for that needed a list of valid domain names in different but controllable TLDs. The only resource to download such list I could find was 3 million records file from Nominum Sample query data [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently running a bunch of tests on DNS resolver software called  <a  target="_blank" href="http://www.unbound.net/"> Unbound </a> to see what it is worth and for that needed a list of valid domain names in different but controllable TLDs. The only resource to download such list I could find was 3 million records file from Nominum  <a  target="_blank" href="ftp://ftp.nominum.com/pub/nominum/dnsperf/data/queryfile-example-3million.gz">  Sample query data file for use with resperf </a> . Only that it contains all kinds of record types &#58; A, PTR, AAAA and  I want list of domain names where I can modify query type but also that it will be of a specific TLD sample.<br />
Say all domains in .ASIA only TLD . To compile such list I took a word list , added to each word specific extensions and then run against some DNS server. Then I filtered the answers to include only existing resolvable domains that return at least 1 answer to query ANY. So far I did it for extensions &#58; .ASIA .COM .CA .BIZ .EDU .EU .FR .INFO .MIL .NET .ORG .RU and it brought 831903 valid domains.<br />
You can download  the final list of those domains here &#58; <a href="http://yurisk.info/domain_list.txt.gz"> Domain list 831903 domains </a></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/08/14/list-of-valid-domain-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 usernames used in SSH brute force</title>
		<link>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/</link>
		<comments>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 09:08:23 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=874</guid>
		<description><![CDATA[In continuation to yesterday&#8217;s post I thought it would be interesting to know statistics of the usernames used in those bruteforce probes. I thought and I did . Find below awk/sed script to get usernames for failed ssh login attempts and sort it for statistics and also list of the usernames I got from my [...]]]></description>
			<content:encoded><![CDATA[<p>In continuation to yesterday&#8217;s post I thought it would be interesting to know statistics of the usernames used in those bruteforce probes. I thought and I did . Find below awk/sed script to get usernames for failed ssh login attempts and sort it for statistics and also list of the usernames I got from my server. The full list of usernames can be found at the end.<br />
The script:</p>
<div class="cmd">awk  &#39;/Failed password for/  &#39;  /var/log/secure*  | sed  &#39;s/.* \([[:print:]]\+\) from .*/  \1  /g &#39; | sort | uniq -c | sort -n -k1</div>
<p>And the winners are:</p>
<table summary="The table listing top 10 usernames used in real cracking attampts on SSH service">
<caption>The table listing top 10 usernames used in real cracking attampts on SSH service</caption>
<tbody>
<tr class="thcolor">
<th>Username</th>
<th>Number of times seen</th>
</tr>
<tr>
<td>mysql</td>
<td>232</td>
</tr>
<tr class="cellcolor">
<td>info</td>
<td>252</td>
</tr>
<tr>
<td>postgres</td>
<td>317</td>
</tr>
<tr class="cellcolor">
<td>guest</td>
<td>435</td>
</tr>
<tr>
<td>nagios</td>
<td>452</td>
</tr>
<tr class="cellcolor">
<td>user</td>
<td>459</td>
</tr>
<tr>
<td>oracle</td>
<td>598</td>
</tr>
<tr class="cellcolor">
<td>admin</td>
<td>884</td>
</tr>
<tr>
<td>test</td>
<td>1017</td>
</tr>
<tr class="cellcolor">
<td>root</td>
<td>22058</td>
</tr>
</tbody>
</table>
<p>Full list of the usernames <a href="http://yurisk.info/usernames.log">Usernames.log</a></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SSH brute force is on the rise</title>
		<link>http://yurisk.info/2010/06/03/ssh-brute-force-on-the-rise/</link>
		<comments>http://yurisk.info/2010/06/03/ssh-brute-force-on-the-rise/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 19:31:43 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Stories from the trenches]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=865</guid>
		<description><![CDATA[SSH brute forcing is still in high demand. I have , for my own testing and pleasure, virtual servers scattered around the world. All of them being of the Linux/BSD family I manage by SSH. The other quirk of mine is that I have on purpose no static IP at home for various reasons (saving [...]]]></description>
			<content:encoded><![CDATA[<p>SSH brute forcing is still in high demand. I have , for my own testing and pleasure, virtual servers scattered around the world. All of them being of the Linux/BSD family  I manage by SSH. The other quirk of mine is that I have on purpose no static IP at home for various reasons (saving  me money being one of them). And to manage those servers by SSH I implement a very simple security rule – from Any to SSH port allow. Port is left to be standard one – 22. After all that time my server was broken into just once , when I gave access by SSH to the colleague of mine and later he changed the password to something crackable in 5 secs. Since then I  &#8211; first don’t give ssh access to colleagues <img src='http://yurisk.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , and second &#8211; look from time to time at ssh failed attempts logs for amusement.</p>
<p>My observations so far are :<br />
- ssh brute forcing is still/yet/again extremely popular and increasing . On average after unfirewalled access to port 22 is discovered it goes to ~ 5000-6000 attempts per day .<br />
- crackers do have some means of communicating between them (market economy ?) – my servers have static IPs and first days after its set up brute force login attempts are as low as 2-10 a day. But once the server IP has been discovered by determined crackers it goes up in numbers very quickly.<br />
- origins of the attacks correlate pretty well with the known sources of Spam/Malware : Brazil, China, US etc.<br />
If you’d like to look at your SSH logs and do some stats on failed attempts here is the awk one-liner I use. Enjoy.</p>
<div class="cmd">awk &#45;&#45;re-interval &#39;/authentication failure/ {}<br />
/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]/ {match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]/,IP);  IPS[IP[0]]++ } END { for (cracker_ips in IPS) print cracker_ips &quot;  &quot; IPS[cracker_ips]}&#39; /var/log/secure.1 | sort -n -k2</div>
<div class="cmdout">190.202.85.3  1<br />
194.192.14.7  1<br />
212.111.199.3  1<br />
222.124.195.1  1<br />
210.71.71.1  2<br />
89.138.195.1  5<br />
212.156.65.7  25<br />
202.117.51.2  32<br />
210.51.48.7  32<br />
115.146.138.5  47<br />
60.191.98.5  88<br />
174.120.208.5  107<br />
61.129.60.2  165<br />
202.103.180.4  175<br />
213.251.192.2  239<br />
91.82.101.4  242<br />
220.173.60.6  264<br />
12.11.210.3  271<br />
144.16.72.1  291<br />
212.118.5.1  360<br />
66.11.122.1  384<br />
211.160.160.1  703<br />
190.12.66.1  999<br />
83.19.184.3  1176<br />
67.213.8.2  4955<br />
199.187.120.2  5312<br />
95.0.180.2  6680<br />
85.131.163.5  7685</div>
<p>NB Crackers IPs are not sanitized</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/06/03/ssh-brute-force-on-the-rise/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Schedule fw monitor to run unattended</title>
		<link>http://yurisk.info/2010/05/29/schedule-fw-monitor-to-run-unattended/</link>
		<comments>http://yurisk.info/2010/05/29/schedule-fw-monitor-to-run-unattended/#comments</comments>
		<pubDate>Sat, 29 May 2010 08:43:48 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=838</guid>
		<description><![CDATA[Not a groundbreaking idea but worth remembering that you can also run scheduled fw monitor using the cron. In case you have some problem occurring at the late night hours or you want to run debug at night when system is loaded less or put your case here this is one of the ways to [...]]]></description>
			<content:encoded><![CDATA[<p>Not a groundbreaking idea but worth remembering that you can also run scheduled fw monitor using the cron. In case you have some problem occurring at the late night hours or you want to run debug at night when system is loaded less or put your case here this is one of the ways to do it.<br />
First, the script named timed_fw_monitor.sh  that starts the <a href="http://yurisk.info/2009/12/12/fw-monitor-command-reference/">fw monitor</a>:</p>
<div class="cmdout">#!/bin/bash<br />
# We have to source Checkpoint environment variables for fw monitor to work<br />
. /etc/profile.d/CP.sh<br />
/opt/CPsuite-R71/fw1/bin/fw monitor -o /home/lambada/capture.cap  -e &#39;accept icmp or port(25);&#39;</div>
<p>Then of course I will want to stop fw monitor , here is the script named stop_fw_monitor.sh that I also put in cron jobs that stops previously started fw monitor :</p>
<div class="cmdout">#!/bin/bash<br />
ps ax | grep  &#39;capture.cap&#39; | grep -v grep | awk &#39;{ print (&quot;kill -s 3 &quot; $1) | &quot;/bin/bash&quot; }&#39;</div>
<p>Now my crontab looks like this:</p>
<div class="cmdout"># DO NOT EDIT THIS FILE &#8211; edit the master and reinstall.<br />
# (/tmp/crontab.4760 installed on Sat May 29 11:00:22 2010)<br />
# (Cron version &#8212; $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)<br />
03 23  * * * /home/lambada/timed_fw_monitor.sh &gt; /dev/null<br />
17 23  * * * /home/lambada/stop_fw_monitor.sh &gt; /dev/null</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/05/29/schedule-fw-monitor-to-run-unattended/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alert on change of SOA in domain</title>
		<link>http://yurisk.info/2010/05/22/alert-on-change-of-soa-in-domain/</link>
		<comments>http://yurisk.info/2010/05/22/alert-on-change-of-soa-in-domain/#comments</comments>
		<pubDate>Sat, 22 May 2010 12:27:57 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[awk weekly]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=819</guid>
		<description><![CDATA[This comes from unpleasant experience of mine. One of my clients’ domain records (MX for the case involved) was mistakenly changed. While it was a human error and trying to fix humans is rolling the rock of Sisyphus,damage would be much lesser had I known about the change immediately . To take care of this [...]]]></description>
			<content:encoded><![CDATA[<p>This comes from unpleasant experience of mine. One of my clients’ domain records (MX for the case involved) was mistakenly changed. While it was a human error and trying to fix humans is rolling the rock of Sisyphus,damage would be much lesser had I known about the change immediately . To take care of this side of the story I wrote awk one-liner that when invoked by cron compares  SOA of the domain with  the one saved locally in the file. If there is a discrepancy the mail is sent.<br />I tried to find more elegant solution on Google but found zillions of tools too complex for such a simple task.</p>
<div class="cmdout">
#!/bin/bash<br />
awk &#39;  BEGIN {&quot;dig +short soa yurisk.info&quot;| getline<br />
  SOA_NOW=$3<br />
getline SOA &lt; &quot;serial-yurisk.info&quot;<br />
  if (SOA_NOW != SOA) { print (&quot; mail -c yurisk@yurisk.info -s \&quot;SOA of domain yurisk.info has changed\&quot;  president@whitehouse.gov&quot;) | &quot;/bin/bash&quot; }}&#39; </div>
<div class="cmdout">serial-yurisk.info:<br />2010012000</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/05/22/alert-on-change-of-soa-in-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

