How to connect to the IRC #2084
(it will be our 'beamer' of today

- Open a terminal

$ sudo nano /etc/hosts

-> it opens the nano text editor,
(127.0.0.1 is your own computer intern adress)

-> add at the end of the list of IP addresses :
192.168.1.222 relearn

ctrl + o : save
ctrl + x : quit

then in your terminal to check that it works
$ ping relearn 

Ping is the 'hello world' op networking
-> can I connect? 
-> ask IP-adress of a computer to see if you can talk to that one: ping IP-adress

$ ifconfig
-> command that gives you your IP-adress

http://geoiptool.com/ to see where an IP address is geographically located
IP addresses starting by 192.168... or 10 are non public IP addresses

server has series of ports (till 3000), each service is connected to specific port
irc listens to port 6667, web is 80, etherpad 9001...

we use IRC as a beamer:
    /join #2084: for experimenting with bots
    /join #2084ircnotes


dump of this morning (from sakasama) (weeding will happen at some point)

*** Logfile started
*** on Mon Jul 7 10:50:16 2014


[Monday 07 July 2014] [10:51:43] <sakasama__> dcc is point to point communication, it's the most private conversation you can get on an irc server
[Monday 07 July 2014] [10:52:04] <ana> it was originally used for file exchange
[Monday 07 July 2014] [10:54:01] <ana> you can set a topic of this channel
[Monday 07 July 2014] [10:54:12] Topic automatist_ sets the channel topic to "hello".
[Monday 07 July 2014] [10:54:22] Topic ana sets the channel topic to "Monday!".
[Monday 07 July 2014] [10:54:49] Topic samuel sets the channel topic to "cats".
[Monday 07 July 2014] [10:54:49] <ana> anne is typing in the command to give each one operator permissions
[Monday 07 July 2014] [10:55:10] <sakasama__> it's '/op nickname'
[Monday 07 July 2014] [10:55:12] Topic samuel sets the channel topic to "puppiesBots".
[Monday 07 July 2014] [10:55:37] <ana> to set the topic type /topic name_topic
[Monday 07 July 2014] [10:56:07] <ana> :topic who_owns_this_room?
[Monday 07 July 2014] [10:56:19] Topic ana sets the channel topic to "who_owns_this_room?".
[Monday 07 July 2014] [10:56:36] <ana> is everyone operator now?
[Monday 07 July 2014] [10:56:56] <sakasama__> in konversation you have a green shirt if you're an operator, white is non-op
[Monday 07 July 2014] [10:57:06] <cc> 10 nicks (10 ops)
[Monday 07 July 2014] [10:57:46] 431 sakasama__ No nickname given
[Monday 07 July 2014] [10:58:03] <ana> try /whois nickname
[Monday 07 July 2014] [10:58:15] <ana> it publishes privately information about that person
[Monday 07 July 2014] [10:58:43] <ana> it does not give real ip adress
[Monday 07 July 2014] [10:58:51] <ana> it hides it
[Monday 07 July 2014] [10:58:58] <ana> does not give a lot of information
[Monday 07 July 2014] [11:03:45] <ana> plan for this afternoon: 
[Monday 07 July 2014] [11:03:55] <ana> work with Martino to extend local network
[Monday 07 July 2014] [11:04:07] <ana> creating a long line of small devices
[Monday 07 July 2014] [11:04:25] <ana> and to install this in the Palace of Justice on Tuesday or Wednesday
[Monday 07 July 2014] [11:05:10] <ana> this morning: what is a bot? how to program it?
[Monday 07 July 2014] [11:06:18] <ana> http://www.irchelp.org/irchelp/misc/botfaq.html
[Monday 07 July 2014] [11:06:21] <Robert> https://openwrt.org/
[Monday 07 July 2014] [11:08:52] <ana> you run a bot from your own machine
[Monday 07 July 2014] [11:10:06] <ana> we're using git repository
[Monday 07 July 2014] [11:10:49] <automatist_> use the terminal:
[Monday 07 July 2014] [11:10:51] <automatist_> and type
[Monday 07 July 2014] [11:11:02] <automatist_> git clone relean@relearn:git/relearn.git
[Monday 07 July 2014] [11:11:08] <automatist_> git clone relearn@relearn:git/relearn.git
[Monday 07 July 2014] [11:11:11] <automatist_> oops
[Monday 07 July 2014] [11:12:03] <ana> a bit mor einfo about ssh
[Monday 07 July 2014] [11:12:20] <ana> you need to connect to it in order to download git repository
[Monday 07 July 2014] [11:12:29] <ana> open web browser
[Monday 07 July 2014] [11:12:31] <ana> type relearn
[Monday 07 July 2014] [11:12:59] <ana> click on folder 'botnet'
[Monday 07 July 2014] [11:14:44] <ana> load http://relearn/botnet/10_things_to_do_with_a_network.html
[Monday 07 July 2014] [11:19:14] <ana> irc has text based interface
[Monday 07 July 2014] [11:19:15] <sakasama__> social chat space
[Monday 07 July 2014] [11:19:32] <ana> can be a representation of a terminal/shell
[Monday 07 July 2014] [11:20:30] <ana> you can talk to your machine but also to a server, using program ssh (secure shell)
[Monday 07 July 2014] [11:20:47] <ana> when you have login to a server, you can do many things
[Monday 07 July 2014] [11:20:53] <ana> f.ex. use it to have files remotely
[Monday 07 July 2014] [11:21:10] <ana> we use that together with git to allow you to pull and push
[Monday 07 July 2014] [11:21:21] <sakasama__> read/write a file remotely
[Monday 07 July 2014] [11:21:31] <ana> you can set this up so you don't have to retype each time all the commands & passes
[Monday 07 July 2014] [11:21:35] <sakasama__> the git repo as a portable archive of relearn
[Monday 07 July 2014] [11:21:54] <ana> every one can copy the git repository (files + history)
[Monday 07 July 2014] [11:23:37] <ana> ssh to relearn server
[Monday 07 July 2014] [11:23:41] <ana> open the terminal
[Monday 07 July 2014] [11:24:06] <sakasama__> ssh relearn@192.168.1.222
[Monday 07 July 2014] [11:24:20] <sakasama__> ssh relearn@relearn
[Monday 07 July 2014] [11:24:37] <sakasama__> it's because of what we did at first
[Monday 07 July 2014] [11:24:39] <ana> it asks for password
[Monday 07 July 2014] [11:24:48] <sakasama__> that we had relearn to our hosts
[Monday 07 July 2014] [11:25:06] <ana> if it is the 1st time you connect, it asks you if you really want to do this
[Monday 07 July 2014] [11:25:19] <ana> if you sa yes, it remembers your IP adress behavior
[Monday 07 July 2014] [11:28:27] <ana> we have all the same account
[Monday 07 July 2014] [11:28:35] <ana> server of trust!
[Monday 07 July 2014] [11:29:34] <ana> you need wifi to connect to house local server
[Monday 07 July 2014] [11:31:19] <arman> wifi or ethernet
[Monday 07 July 2014] [11:33:29] <ana> ssh key has 2 parts: private & public key
[Monday 07 July 2014] [11:33:56] <ana> you give your public key away, ssh verifies that to your local key to see if they fit
[Monday 07 July 2014] [11:35:25] <ana> open new tab in your terminal
[Monday 07 July 2014] [11:35:33] <ana> check if you have already ssh key
[Monday 07 July 2014] [11:35:36] <ana> in home folder
[Monday 07 July 2014] [11:35:47] <ana> $ ls .ssh
[Monday 07 July 2014] [11:36:10] <ana> what I see: authorized_keys authorized_keys.pub known_hosts
[Monday 07 July 2014] [11:36:57] <ana> id_rsa id_rsa.pub -> these are real keys
[Monday 07 July 2014] [11:37:27] <ana> if you don't have these, you need to creat them
[Monday 07 July 2014] [11:38:17] <ana> for instructions see http://relearn/botnet/10_things_to_do_with_a_network.html
[Monday 07 July 2014] [11:41:35] <sakasama__> don't generate your ssh key directly on the server
[Monday 07 July 2014] [11:42:04] <ana> checkin your terminal if your connected to your machine or to relearn@robotnik:
[Monday 07 July 2014] [11:42:44] <arman> keep your private key safe. You only share id_rsa.pub
[Monday 07 July 2014] [11:43:47] <sakasama__> then copy your private key on the server (see the instructions at the 10 things to do with a network)
[Monday 07 July 2014] [12:14:34] <Demure> #2084
[Monday 07 July 2014] [12:21:18] <ana> all cloned git repository?
[Monday 07 July 2014] [12:21:32] <ana> if yes, go into the bots folder
[Monday 07 July 2014] [12:21:56] <ana> cd relearn/botnet/bots
[Monday 07 July 2014] [12:22:05] <automatist_> sudo apt-get install python-pip
[Monday 07 July 2014] [12:22:21] <automatist_> is the command that installs the python package manager
[Monday 07 July 2014] [12:22:23] <automatist_> and then...
[Monday 07 July 2014] [12:22:26] <automatist_> sudo pip install irc
[Monday 07 July 2014] [12:22:33] <automatist_> is the command to install the irc moudle
[Monday 07 July 2014] [12:22:34] <automatist_> module
[Monday 07 July 2014] [12:24:00] <automatist_> finally cd botnet/bots
[Monday 07 July 2014] [12:24:03] <automatist_> python hellobot.py
[Monday 07 July 2014] [12:25:39] <automatist_> and finally,
[Monday 07 July 2014] [12:26:07] <automatist_> python hellobot.py --host relearn "#2084" myhellobotorwhatevernameyouwant
[Monday 07 July 2014] [12:28:15] <there_now> hello
[Monday 07 July 2014] [12:35:58] <ana> you can now edit the message of your hellobot.py
[Monday 07 July 2014] [12:36:07] <ana> gedit hellobot.py
[Monday 07 July 2014] [12:37:10] <ana> on line 18
[Monday 07 July 2014] [12:38:52] <ana> change 'HELLO' into something else
[Monday 07 July 2014] [12:39:24] <ana> stop hellobot.py using the command: ctrl +c
[Monday 07 July 2014] [12:39:28] <ana> launch the bot again
[Monday 07 July 2014] [12:39:52] <ana> (oh yes, do not forget to dsave your changes in gedit)
[Monday 07 July 2014] [12:55:15] <ana> timekeeper says: it's time to eat

[15:19] <schrijver> Python is a general purpose language
[15:20] <sakasama__> looking at python cookbook
[15:22] <schrijver> Chapter 1 Python Shortcuts                                                                     Chapter 2 Searching and Sorting                                                                     Chapter 3 Text                                                                     Chapter 4 Files                                                                     Chapter 5 Object-Oriented Programming                                                              
[15:22] <schrijver>   Chapter 6 Threads, Processes, and Synchronization                                                                     Chapter 7 System Administration                                                                     Chapter 8 Databases and Persistence                                                                     Chapter 9 User Interfaces                                                                     Chapter 10 Network Programming             
[15:22] <schrijver>                                                    Chapter 11 Web Programming                                                                     Chapter 12 Processing XML                                                                     Chapter 13 Distributed Programming                                                                     Chapter 14 Debugging and Testing                                                                     Chapter 15 Progra
[15:22] <schrijver> About Programs                                                                     Chapter 16 Extending and Embedding                                                                     Chapter 17 Algorithms                                                                     Chapter 18 List of Contributors                                                                     Chapter 1 Python Shortcuts                                                           
[15:22] <schrijver>      Chapter 2 Searching and Sorting                                                                     Chapter 3 Text                                                                     Chapter 4 Files                                                                     Chapter 5 Object-Oriented Programming                                                                     Chapter 6 Threads, Processes, and Synchronization                                  
[15:22] <schrijver>                               Chapter 7 System Administration                                                                     Chapter 8 Databases and Persistence                                                                     Chapter 9 User Interfaces                                                                     Chapter 10 Network Programming                                                                     Chapter 11 Web Programming        
[15:22] <schrijver>                                                         Chapter 12 Processing XML                                                                     Chapter 13 Distributed Programming                                                                     Chapter 14 Debugging and Testing                                                                     Chapter 15 Programs About Programs                                                                     Chap
[15:22] <schrijver> 16 Extending and Embedding                                                                     Chapter 17 Algorithms                                                                     Chapter 18 List of Contributors 
[15:22] <schrijver> High Level
[15:22] <schrijver> http://shop.oreilly.com/product/9780596001674.do
[15:22] <there_now> general purpose language to use in many different contxts
[15:23] <there_now> ipython good to test things
[15:23] <sakasama__> sudo apt-get install ipython
[15:23] <automatist_>  sudo apt-get install ipython
[15:23] <automatist_> indeed
[15:23] <automatist_> ipython to start it then
[15:24] <schrijver> I imagine in OS X one can do:
[15:24] <sakasama__> you can still use the text editor
[15:24] <schrijver> sudo easy_install ipython
[15:48] <there_now> different kind of representation in python
[15:48] <there_now> different "types"
[15:48] <there_now> quote=STR
[15:48] <there_now> number= ITG integrer
[15:51] <there_now> turning symbol into a variable is key to the program 
[15:51] <there_now> m='somekind of sentence'
[15:52] <there_now> it has no immediate effect but is stored in the memory
[15:52] <there_now> now if u type m u get 'some kind of sentence'
[15:53] <there_now> then you can impact the variable
[15:54] <there_now> ex: m=m*2 is "some kind of sentencesome kind of sentence"
[15:55] <there_now> 'hello'+'world'='helloworld
[15:56] <there_now> oops 'helloworld'
[15:58] <there_now> every value that you have may contain some value
[16:00] <there_now> to look for possible functions go .
[16:00] <there_now> to activate the function go .function()
[16:01] <there_now> m.upper    "SOMEKINDOFSENTENCE"
[16:01] <armansansd> value . + tab , and will see all the possible fonctions
[16:01] <there_now> oops that is m.upper()
[16:08] <there_now> [in bracket] it is like a list, an array
[16:09] <there_now> to go back from a list to a textyou need the inverse of split
[16:11] <armansansd> type(var) to know what this variable is? 
[16:11] <there_now> function .join  but it is a string function
[16:18] <armansansd> when you have a single quote in your text you should use an alternative mark : " or / . for exemple a="what's your name ?"
[16:20] <there_now> when you use a function you need to assign it to something
[16:21] <there_now> so what you can do is var=var.function()
[16:23] <there_now> split and then .strip
[16:23] <there_now> is quite a common procedure
[16:23] <there_now> .strip gets rid of blank spaces
[16:24] <there_now> then reassembly step ' '.join
[16:24] <there_now> ' ' .join(var)
[16:28] <armansansd> python is very precise with spacing.
[16:33] <there_now> in french http://fr.openclassrooms.com/informatique/cours/programmer-un-bot-irc-simplement-avec-ircbot
[17:28] <Robert> hi
[17:32] <armansansd> does someone know how to reuse a value in a message ? 
[17:43] <armansansd> ok you have to write it like that : "hello"+str(value)+"world"


