<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>ZoZo's Blog</title>
 <link href="http://zozo123.github.io/index.html/" rel="self"/>
 <link href="http://zozo123.github.io/index.html"/>
 <updated>2016-05-23T21:45:26+00:00</updated>
 <id>http://zozo123.github.io/index.html</id>
 <author>
   <name>Yo Eli</name>
   <email>eliaz123@cs.huji.ac.il</email>
 </author>

 
 <entry>
   <title>How to start being an Hacker</title>
   <link href="http://zozo123.github.io/index.html/2014/03/03/how-to-start-being-an-hacker"/>
   <updated>2014-03-03T00:00:00+00:00</updated>
   <id>http://zozo123.github.io/index.html/2014/03/03/how-to-start-being-an-hacker</id>
   <content type="html">
&lt;p&gt;Today I met a bunch of very talented 9th grade students.&lt;/p&gt;

&lt;p&gt;I thought it might be useful, if I list what it is recommended for start being an Hacker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;disclaimer: one should use the following tools and skills with responsibility and for good purposes, AKA
&lt;a href=&quot;http://en.wikipedia.org/wiki/White_hat_(computer_security)&quot;&gt;White Hat Hackering&lt;/a&gt;. &lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
	Studying a low level languages:
	&lt;ul&gt;
		&lt;li&gt;
			Assembly -ARM or &lt;a href=&quot;http://www.cs.virginia.edu/~evans/cs216/guides/x86.html&quot;&gt; x86 assembly&lt;/a&gt;. you might want to google for: NASM, &lt;a href=&quot;https://www.hex-rays.com/products/ida/&quot;&gt;ida&lt;/a&gt; and disassembly tools.
		&lt;/li&gt;
		&lt;li&gt;
			C - IMO it is must to know how to code and understand the &lt;a href=&quot;http://www.ro.feri.uni-mb.si/predmeti/mik_si/C_prir/CLIST.HTM&quot;&gt;c&lt;/a&gt; code basics. 
		&lt;/li&gt;
	&lt;/ul&gt; 

&lt;/li&gt;
&lt;li&gt;Studying networks &lt;a href=&quot;http://seclab.cs.sunysb.edu/sekar/papers/netattacks.pdf&quot;&gt;basics&lt;/a&gt;.&lt;/li&gt;

&lt;li&gt;Be familiar with web applications mechanism:
	&lt;ul&gt;
		&lt;li&gt;
			Client side: HTML, Java Script.
		&lt;/li&gt;
		&lt;li&gt;
			Server side (backend) e.g dotnet, ruby on rails, php, JavaServer Pages [JSP].
		&lt;/li&gt;
		&lt;li&gt;
			Databases: SQL, nosql, Microsoft SQL, MySQL ,SQL injections.
		&lt;/li&gt;
	&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;
	Operating system internals.
&lt;/li&gt;

&lt;li&gt;
	Scripting: &lt;a href=&quot;http://www.ubuntu.com/&quot;&gt;Linux&lt;/a&gt; shell, Microsoft power shell. running and writing batch files in windows, python.
&lt;/li&gt;

&lt;li&gt;
	practice within those tools:
	&lt;ul&gt;
		&lt;li&gt;
	 		&lt;a href=&quot;http://backtrack-linux.org&quot;&gt;backtrack-linux.org&lt;/a&gt;
	 	&lt;/li&gt;
	 	&lt;li&gt;	
	 		&lt;a href=&quot;http://www.net-force.nl/&quot;&gt;http://www.net-force.nl/&lt;/a&gt;
		&lt;/li&gt;
		&lt;li&gt;
	 		&lt;a href=&quot;io.smashthestack.org:84/&quot;&gt;io.smashthestack.org:84/&lt;/a&gt;
	 	&lt;/li&gt;
	 	&lt;li&gt;
	 		&lt;a href=&quot;http://www.digitalwhisper.co.il/&quot;&gt; digital whisper - Hebrew tutorials&lt;/a&gt;
	 	&lt;/li&gt;
	&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;I believe the list above is a great kick starting for a newbie, and the rest can be studied by “being into” security and studying things by yourself.&lt;/strong&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Generating list's subsets - Python</title>
   <link href="http://zozo123.github.io/index.html/2013/12/03/python-subset"/>
   <updated>2013-12-03T00:00:00+00:00</updated>
   <id>http://zozo123.github.io/index.html/2013/12/03/python-subset</id>
   <content type="html">
&lt;p&gt;Once a month a &lt;strong&gt;“how to generate all subsets in python”&lt;/strong&gt; question appers on &lt;a href=&quot;http://www.stackoverflow.com&quot;&gt;stackoverflow&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The OP (“Original poster”) of the question apparently found an itertools based implementation.&lt;/p&gt;

&lt;p&gt;But what he really looked for is an algorithm to create all the subsets.&lt;/p&gt;

&lt;p&gt;There are fewer solutions on &lt;a href=&quot;http://www.stackoverflow.com&quot;&gt;stackoverflow&lt;/a&gt; that implements the naive alogrithm in python.&lt;/p&gt;

&lt;p&gt;Unfortuntally I couldn’t find the awesome and elegant original post, but I rewrote it somehow and post it here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The naive implementation:&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;naiveSubsetGen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
	&lt;span class=&quot;n&quot;&gt;subsets&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[]]&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
		&lt;span class=&quot;n&quot;&gt;subsets&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;subsets&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;subsets&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;subsets&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;strong&gt;The itertools solution:&lt;/strong&gt;&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;itertools&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;combinations&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;itertoolsSubsetGen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[]]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;j&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;combinations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I benchmarked both of them:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;n&quot;&gt;itertoolTestStr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;\
&lt;span class=&quot;s&quot;&gt;&quot;&quot;&quot;
for i in xrange(5,25,5):
	itertoolsSubsetGen(range(i+1))
&quot;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;naiveTestStr&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;\
&lt;span class=&quot;s&quot;&gt;&quot;&quot;&quot;
for i in xrange(5,25,5):
	naiveSubsetGen(range(i+1))
&quot;&quot;&quot;&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;setupItertool&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;&quot;&quot;from __main__ import itertoolsSubsetGen&quot;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;setupNaive&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;from __main__ import naiveSubsetGen&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__name__&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&#39;__main__&#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
	&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;timeit&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;naive time:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;timeit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timeit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;naiveTestStr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setupNaive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;itertools time:&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timeit&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;timeit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;itertoolTestStr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;setup&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;setupItertool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h4&gt;Results:&lt;/h4&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;n&quot;&gt;naive&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;8.25990605354&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;itertools&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;12.5649080276&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
 </entry>
 
 <entry>
   <title>Mono for MAC - C# for mac OSx</title>
   <link href="http://zozo123.github.io/index.html/2013/11/30/mono-mac"/>
   <updated>2013-11-30T00:00:00+00:00</updated>
   <id>http://zozo123.github.io/index.html/2013/11/30/mono-mac</id>
   <content type="html">
&lt;p&gt;Was trying for the first time running mono on mac osx. Tracing the steps I went through.&lt;/p&gt;

&lt;p&gt;Download and run &lt;strong&gt;Mono MRE installer&lt;/strong&gt; from
&lt;a href=&quot;http://www.go-mono.com/mono-downloads/download.html&quot;&gt;http://www.go-mono.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;create a &lt;strong&gt;hello.cs&lt;/strong&gt; file and feed it with the helloworld code:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-aspx-cs&quot; data-lang=&quot;aspx-cs&quot;&gt;using System;
using System.Windows.Forms;
 
public class HelloWorld : Form
{

	static public void Main ()
	{
		Application.Run (new HelloWorld ());
	}

	private void buttonClickFunc(object sender, EventArgs ei)
	{
		MessageBox.Show(&quot;How cool is that ?&quot;);
	}

	public HelloWorld ()
	{	
		Text = &quot;Hello Mono World&quot;;
		Button button = new Button();   
		button.Left = (this.Width - button.Width) / 2;
		button.Top = (this.Height - button.Height) / 2;
		this.Controls.Add(button);      
		button.Text = &quot;Hello&quot;;
		button.Click += buttonClickFunc;
	}

}&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now let’s compile and execute the snippet:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;gmcs hello.cs -pkg:dotnet&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Mostly you will encounter the following error:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;Package dotnet was not found &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;the pkg-config search path.
Perhaps you should add the directory containing &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;dotnet.pc&lt;span class=&quot;s1&quot;&gt;&#39;
to the PKG_CONFIG_PATH environment variable
No package &#39;&lt;/span&gt;dotnet&lt;span class=&quot;s1&quot;&gt;&#39; found
error CS8027: Error running pkg-config. Check the above output.&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;we need to add &lt;code&gt;PKG_CONFIG_PATH&lt;/code&gt; the path of the
dotnet package. In order to figure out where the package is located.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sudo find / -iname &lt;span class=&quot;s2&quot;&gt;&quot;dotnet.pc&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Copy the directory found e.g.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;/Library/Frameworks/Mono.framework/Versions/3.2.5/lib/pkgconfig/ &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;to &lt;code&gt;PKG_CONFIG_PATH&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;edit &lt;code&gt;.bash_profile&lt;/code&gt; or &lt;code&gt;.bashrc&lt;/code&gt; files&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;sudo vim ~/.bash_profile&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;and add the next line at the end of the file&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PKG_CONFIG_PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$PKG_CONFIG_PATH&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:/Library/Frameworks/Mono.framework/Versions/3.2.5/lib/pkgconfig/&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;open a new bash or&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt; ~/.bash_profile&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;.
and then we right to go compiling the code and execute it:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;gmcs hello.cs -pkg:dotnet
mono hello.exe&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;&lt;img src=&quot;/assets/monoExample.png&quot; alt=&quot;A screenshot on my mac&quot; /&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Hello World</title>
   <link href="http://zozo123.github.io/index.html/2013/10/11/hello-world"/>
   <updated>2013-10-11T00:00:00+00:00</updated>
   <id>http://zozo123.github.io/index.html/2013/10/11/hello-world</id>
   <content type="html">
</content>
 </entry>
 
 
</feed>