Federico Amedeo Izzo пре 7 година
родитељ
комит
0088eadeb7
66 измењених фајлова са 1964 додато и 4 уклоњено
  1. 54 0
      Advanced OS & Embedded Sys/lesson_01.md
  2. 83 0
      Advanced OS & Embedded Sys/lesson_03.md
  3. 130 0
      Computer Ethics/lesson_01.md
  4. 156 0
      Computer Ethics/lesson_02.md
  5. 80 0
      Computer Ethics/lesson_03.md
  6. 79 0
      Computer Ethics/lesson_04.md
  7. 6 0
      Computer Security/genpdf.sh
  8. 2 0
      Computer Security/lesson_01.md
  9. 1 0
      Computer Security/lesson_04.md
  10. 1 0
      Computer Security/lesson_05.md
  11. 1 0
      Computer Security/lesson_06.md
  12. 1 0
      Computer Security/lesson_07.md
  13. 1 1
      Computer Security/lesson_09.md
  14. 1 0
      Computer Security/lesson_10.md
  15. 1 0
      Computer Security/lesson_11.md
  16. 1 1
      Computer Security/lesson_13.md
  17. 23 0
      Computer Security/lesson_14.md
  18. 14 0
      Computer Security/lesson_15.md
  19. 44 0
      Computer Security/lesson_16.md
  20. 44 0
      Computer Security/lesson_17.md
  21. 32 0
      Computer Security/lesson_18.md
  22. 32 0
      Computer Security/lesson_19.md
  23. 172 0
      Cryptography/exe_01.md
  24. 12 0
      Cryptography/lesson_01.md
  25. BIN
      Game Theory/.lesson_03.md.swp
  26. 23 0
      Game Theory/lesson_03.md
  27. 17 0
      OR/lesson_01.md
  28. 6 0
      Piattaforme Software per la Rete/MOD1/genpdf.sh
  29. 14 0
      Piattaforme Software per la Rete/MOD1/lesson_00.md
  30. 3 0
      Piattaforme Software per la Rete/MOD1/lesson_01.md
  31. 1 0
      Piattaforme Software per la Rete/MOD1/lesson_02.md
  32. 3 0
      Piattaforme Software per la Rete/MOD1/lesson_03.md
  33. 3 0
      Piattaforme Software per la Rete/MOD1/lesson_04.md
  34. 2 0
      Piattaforme Software per la Rete/MOD1/lesson_05.md
  35. 3 0
      Piattaforme Software per la Rete/MOD1/lesson_06.md
  36. 3 0
      Piattaforme Software per la Rete/MOD1/lesson_07.md
  37. 2 0
      Piattaforme Software per la Rete/MOD1/lesson_08.md
  38. 2 0
      Piattaforme Software per la Rete/MOD1/lesson_10.md
  39. 3 0
      Piattaforme Software per la Rete/MOD1/lesson_11.md
  40. 2 0
      Piattaforme Software per la Rete/MOD1/lesson_12.md
  41. 1 0
      Piattaforme Software per la Rete/MOD1/lesson_13.md
  42. 0 1
      Piattaforme Software per la Rete/MOD1/lesson_14.md
  43. 144 0
      Piattaforme Software per la Rete/MOD1/lesson_15.md
  44. 120 0
      Piattaforme Software per la Rete/MOD1/lesson_16.md
  45. 87 0
      Piattaforme Software per la Rete/MOD1/lesson_17.md
  46. 103 0
      Piattaforme Software per la Rete/MOD1/lesson_18.md
  47. 6 0
      Piattaforme Software per la Rete/MOD2/genpdf.sh
  48. 13 0
      Piattaforme Software per la Rete/MOD2/lesson_00.md
  49. 3 0
      Piattaforme Software per la Rete/MOD2/lesson_01.md
  50. 1 0
      Piattaforme Software per la Rete/MOD2/lesson_02.md
  51. 3 0
      Piattaforme Software per la Rete/MOD2/lesson_03.md
  52. 3 1
      Piattaforme Software per la Rete/MOD2/lesson_04.md
  53. 3 0
      Piattaforme Software per la Rete/MOD2/lesson_05.md
  54. 3 0
      Piattaforme Software per la Rete/MOD2/lesson_06.md
  55. 2 0
      Piattaforme Software per la Rete/MOD2/lesson_07.md
  56. 3 0
      Piattaforme Software per la Rete/MOD2/lesson_08.md
  57. 3 0
      Piattaforme Software per la Rete/MOD2/lesson_09.md
  58. 3 0
      Piattaforme Software per la Rete/MOD2/lesson_10.md
  59. 10 0
      Principles of Programming Languages/lesson_01.md
  60. 135 0
      Segnali/lesson_01.md
  61. 34 0
      polimd_archived/operations_research/lesson_01.md
  62. 97 0
      polimd_archived/operations_research/lesson_02.md
  63. 0 0
      polimd_archived/operations_research/note_follows_on_paper
  64. 95 0
      polimd_archived/soft_computing/lesson_01.md
  65. 34 0
      polimd_archived/soft_computing/lesson_02.md
  66. 0 0
      polimd_archived/soft_computing/note_follows_on_paper

+ 54 - 0
Advanced OS & Embedded Sys/lesson_01.md

@@ -0,0 +1,54 @@
+# Advanced Operating Systems and Embedded Systems - lesson 1
+#### William Fornaciari
+###### 4 October 2016
+## Introduction
+
+Website of the last year for slides.
+
+Cinch box -> very rugged, 70€
+
+## Embedded Systems
+Usually in the embedded field we have constrained resources with respect to the general purpose world.
+For example:
+- Very few memory/storage/processing power
+- Thermal/power consumption constraints.
+
+It is not so easy to define an __embedded__ architecture, the basic is a Von Neumann model with
+emphasis on sensors/actuators and power constraints.
+
+## Embedded Market Status
+While we still haven't smart houses?
+There is no market, so there is no need.
+
+And also the market is very fragmented because there is no collaboration between brands.
+
+There are some advancements in the *automotive market*
+In 2007 there was balance between the cost of the iron and cost of the electronics in the
+automotive market, nowadays the electronics cost more.
+
+## Application Contexts
+__The four directions are__
+- Nomadic
+- Public Infrastructures
+- Industrial Systems
+- Private Spaces
+__While two recurring needs are__
+- Networking
+- Sensing
+
+## Solutions
+There is not a unique solution, but there are some good or worse solutions.
+For example wifi is not suited for the embedded market, but other technologies like ZigBee and BLE also have limitations.
+
+## Direction
+- Networked
+- Secure
+- Complex:
+   - Giga complexity by nano technology
+   - Complex through heterogeneity
+- Thermal/power control: run-time management of resources.
+
+## Embedded Systems Design
+Field knowledge is necessary so and emb. eng. have to cooperate with domain experts or keep in mind
+notion of physics.
+

+ 83 - 0
Advanced OS & Embedded Sys/lesson_03.md

@@ -0,0 +1,83 @@
+# Advanced Operating Systems and Embedded Systems - lesson 3
+#### William Fornaciari
+###### 11 October 2016
+## Real Time Operating Systems
+### Real time system
+
+Is a system which has to provide a result within a time range
+usually before a *deadline*
+#### Classification
+- __mission critical systems__
+    - tipycally involves safety
+    - static allocation of resources 
+- __soft real time__: Best effort performance, if the system underperforms, 
+nobody dies but we have a loss of quality
+
+In a system like windows OS, a general delay from an event like mouse movement
+and the reaction takes 200ms, while is a __RTOS__ this time needs to be under 10ms.
+
+#### Charachteristics required for a RTOS
+- __Deterministic behaviour__: operations are executed ad predetermined times or intervals
+- __Responsiveness__: involves minimum interrupt latency, and is due to the fact that
+usually RTOS systems are part of control loops, and the speed of the control system
+needs to be some tipically 5 times the speed of the system.
+Measures to guarantee fast ISR time include:
+    - Inhibiting nested routines
+    - Calling ISR without context switching
+- __User control__: User should have a much more specific control on applications
+w.r.t. ordinary OS
+- __Reliability__: The worst case is to have a blue screen where everything stops.
+A much less worse case is to have a graceful degradation of the performances,
+an example is the thermal throttling of the CPUs when overheating.
+
+For example in the case of a washing machine, in case of a power loss we have 30-100ms
+before the capacitors discharge, to save the content of RAM to a permanent memory.
+This behaviour is called __fail-soft__ and consists of preserving as much data
+ad possible in case of failure.
+
+#### RTOS Features
+- Low cost, small size: usually they employ open-source code.
+- ~20 tasks usually required for an embedded project.
+- Use of *semaphors* for fast access protection.
+- A general paradigm for fast access is *shared memory* protected by *semaphors*
+- For choosing __schedulers__ predictability is preferred over complexity,
+because of this generally used schedulers are *FIFO* or *round robin*
+
+#### Time Constraints
+The "ready" event (process woke up for receiving data) may be:
+- __periodic__: for example sampling at fixed rate, ex: 100Hz
+- __aperiodic__ but predictable
+The computation time may be:
+- Fixed in duration
+- Variable
+- Unpredictable: for example human activity with a computer is unpredictable.
+
+#### Deadlines
+- __hard__: the computation must be completed within the limit or there will be
+a __critical error__
+- __soft__: the deadline is expressed as a preference, but is not critical.
+The *criticality* of a Deadline can be expressed by means of a __Value Function__
+
+#### Preemption
+Makes possible to suspend a process when another task needs to be executed
+and and restore the work later.
+
+Different tipes of computation can be *preemptable* or not or, only preemptable
+in a specific part of their execution
+
+Keeping the system in a safe state is costly, a better tradeoff could be
+keeping the system in a safe state only for portions of the time.
+#### Schedulability analisys consist in deciding to accept or not a new process
+to guarantee the safely conclusion of the existing processes.
+Can be carried out:
+- statically: at bootstrap time
+- dinamically: when the process is created
+__Static table driven__ sched. an. is suitable only for mature systems
+when the execution of the processes is known from the project.
+A famous example is the __Rate Monotonic__ analisys
+__Dynamic planning based__: feasibility is determined at runtime
+
+### Design Issues
+A key problem is choosing the process to be __executed next__
+Sometimes using a non-preemptive scheduler makes sense because this
+way you can not take away the resources that you have allocated.

+ 130 - 0
Computer Ethics/lesson_01.md

@@ -0,0 +1,130 @@
+# Computer Ethics - lesson 1
+#### Viola Schiaffonati
+###### 19 September 2017
+http://home.dei.polimi.it/schiaffo/CE/
+### Course Introduction
+
+What is Compter Ethics?
+What is Ethics?
+
+#### Ethics
+It's difficult to define, and has many meanings.
+Derives from the Greek word *ethos* that means *custom* or *morals*
+Ethics is the science considering what is **good** and what is **bad**
+Usually good and bad are considered a personal opinion, while here we study this
+matter as a **science**.
+
+Ethics and *morals* is not just an opinion specific to each person, given by
+that person culture; it is possible to study ethics with a **rational** method.
+
+what's the difference between *morality* and *ethics*
+- Ethics is the study of what is good and what is bad
+- Morality is the group of personal opinions and attitudes.
+
+A **dictionary definition** of ethics and morality can point us in a good
+direction but is not enough for a good study of the matter, in general a
+dictionary definition is never enough in phylosophy.
+
+**Aristotle** is an ancient greek philosopher and scientist.
+He did knew of the existence of Physics' laws (maybe not with the same meaning
+of today) but did not give laws for human behaviour.
+
+Aristotle defines ethics using the phrase *in most of the cases* because in
+human behaviour we can see a recurring behaviour but humans may not always
+behave in the same way.
+
+Aristotle's ethics:
+- **Good actions** as the matter of ethics
+- The nature of **human well-being** as its principal concern
+- **Ethical virtues** (justice, courage, temperance...) as central to a
+  well-lived life
+
+This is called **virtue ethics** and was meant as a way to improve an
+individual's life
+
+This cource is intended to improve our *professional life* to improve the design
+and choices we will make during our engineering career.
+
+Ethics reasoning and having in mind ethical problems is required during
+employment in other european countries.
+
+> How is it possible to deal rigorously with ethicsl problems if morality is
+> subjective?
+
+It is useless to stop a discussion by saying "This is my opinion and you have
+yours", 
+
+> discussing about ethics is a process to search the right kind of
+> morality.
+
+> Ethics is the **systematic reflection** on what is moral.
+Morality can still be personal while ethics is a *meta-reflection* on morality.
+
+Ethics is a way to increase our ability to cope with **moral problems**
+But ethics is not a manual with answers, but can give *critical tools*
+
+> what is computer ethics?
+Class responses:
+- moral side of computers
+- autonomy
+- limits
+- how computers change our lives
+- dependency on machines
+- limit between natural and artificial
+- data / privacy (related but general)
+- impacts on human psychology
+
+We will not start by the classical issues of computer ethics, but we will start
+by **enginnering responsibility**
+
+#### Definition
+> Analysis of the nature and social impact of computer technology, and the
+> corresponding formulation and justification of policies for the ethicsl use of
+> such technology (James Moor 1985)
+
+James Moor said that there are *policies vacuums* for example about the debate
+over autonomous cars during malfunction.
+
+#### Classical problems discussed in Computer Ethics
+- **Computers in the workplace**:
+May workers replaced by computers, is one of the oldest problems (like 1970s)
+but it's still actual because today robots/AI can replace humans not only in a
+mechanical way but also in more creative kind of works.
+**Radical alteration** of skills
+
+- **Computer crime**
+It's not the physical security that is in danger, but rather the *logical
+security*
+We will not discuss technical solutions but more general
+political,phylosophical,ethical choices (more than solutions)
+
+Privacy was already a matter before the introduction of computers, but the
+problema has become more radical.
+
+Information society can be seen as **surveillance society** that is a political
+problem more than ethical.
+
+- **Intellectual property**
+There are different aspects of software that we can own:
+    - the source code
+    - the object code
+    - the algorithm
+    - the look and feel
+There are also many ways of *software ownership*.
+For the first time human laws are made on a global context:
+    - Global laws
+    - Gloabl education: and impact on dictatorships, small communities,
+      religions...
+
+#### why Computer Ethics
+> Technology is not neutral
+Technological development is not isolated from the world, but technology is
+always inserted in a social context.
+This idea is called *socio-technical* perspective.
+
+Technological universities usually consider technology a world on its own.
+
+In the design of a product there may be ethical choices, and Computer Ethics may
+help us steer the development of future technologies in a direction that is good
+for humanity (and you).
+

+ 156 - 0
Computer Ethics/lesson_02.md

@@ -0,0 +1,156 @@
+# Computer Ethics - lesson 1
+#### Viola Schiaffonati
+###### 19 September 2017
+### Engineering Responsibility
+
+#### An example: the **Challenger disaster**
+
+In 1986 the first launch of a space shuttle with a civilian onboard,
+the shuttle exploded after 73 seconds from takeoff.
+
+Years later the cause was found to be the O-rings (rubber sealing rings) that
+failed to work properly at low temperatures, so fuel started to leak and caught
+fire.
+
+There is a difference between *legal responsibility* and *moral responsibility*
+
+The **legal resposibility** was attributed to the o-rings failure, and nobody
+was blamed, but the **moral responsibility** is to be found elsewhere.
+
+In July 1985 an engineer at Morton Thiokol (supplier of the O-rings)
+communicated his concernment about the reliability of the O-rings
+
+A project group was set up to investigate the problem but with low funds and
+information, and the research was not successful.
+
+The night before the flight:
+
+The launching had already been delayed 5 times (partly for weather related
+reasong: low temperatures at night)
+
+Morton Thiokol had warned NASA to not go ahead with the launch below 11 degrees
+Celsius.
+
+NASA claimed that *the data were insufficient to declare the launch unsafe*
+
+This is strange because usually we need data to declare something *safe*, not
+the contrary
+
+There was a second conference in which MT decided that the launch had to be done
+(in view of a contract extension)
+
+The points that emerge is that:
+- There is a kind of responsibility from MT in delivering a defective/untested
+  product and making a financial decision.
+- Boisjoly also could have contacted directly NASA about the problem.
+
+After a __Presidential committee__ the blame of the incident was given to a
+communication problem inside NASA and between the suppliers.
+
+The space mission was suspended for 2 years and the communication structure of
+nasa was changed by involving more the engineering part.
+
+Definitions:
+- **accountability** is necessary to be **responsible** of something
+
+For example Boisjoly was not accountable as an engineer, regarding the project,
+but he wa also a *human being* and as such he could have warned NASA for
+example.
+
+- **Responsibility** is linked to the **role** that you have in a situation.
+- Responsibility based on *roles*
+    - **Moral responsibility**
+    - **Professional responsibility**
+- Responsibility:
+    - active responsibility
+    - passive responsibility
+
+#### Passive Responsibility
+
+Is a kind of *backward-looking* responsibility, which
+is relevan after something undesirable occurred.
+- **accountability**
+NASA was accountable to the family of the victims, society and sitting judge.
+- **blameworthiness**
+For someone to be blameworthy, the following conditions are needed:
+- wrong-doing: NASA had to prove the flight to be safe
+- causal contribution: Both NASA project team and Morton Thiokol management
+  could have postponed the launch
+- foreseeability: knowing the consequences of an action
+- freedom of action: NASA team project, MT and Boisjoly were under presure but the
+  pressure was not enough to declare that they lacked freedom of action.
+
+#### Active Responsibility
+
+It's the responsibility *before* something bad happens.
+
+> Prevent the negative effects of technology but also realizing certain positive
+> effects (bovens 1998)
+
+Artifacts can try to implement in their design some values, like "do not drive
+when drunk" or "do not use much water"
+
+Computer engineers have a code provided by ACM
+
+It requires:
+- perception of violations
+- consideration of the consequences
+- Autonomy
+- ...
+
+#### Ideals of engineering
+Are all ideals of engineers morally commendable
+
+ideals may be:
+- Behaving in the profession for the common good and not following pressure.
+- Try to obtain technological advancement / be an efficient engineer
+- Technological enthusiasm
+
+Technological enthisiasm may have consequences, like in the development of
+Google Earth.
+
+negative effect were overlooked, like privacy and security issues.
+One of the boardmen of Google, Marissa Meyer said that "Engineers don't need to
+care about consequences, they are only committed to find the best technical
+solution"
+
+- Effectiveness: extent to which an established goal is achieved
+- Efficiency: the ratio between the goal achieved and the effort required
+consequences
+
+They are apparently neutral, objective and measurable
+example: Taylorism and the idea of scientific management, which attempt to
+design a production process and ultimately society.
+
+Also the **professional practice** of engineers is not morally neutral.
+
+#### Engineers versus managers
+Three models of dealing with this conflict:
+- separatism
+- technocracy
+- whistle-blowing
+
+**Separatism** is the idea that scientist and engineers should apply the
+technical inputs but the management an political organs should make the value
+decisions.
+
+Boisjoly was of this opinion stating that he would have not done anything more
+of what he already did.
+
+**Technocracy** Frederick Taylor proposed that engineers should take over the
+role of managers in the governancce of companies and that of politicians in the
+governance of society.
+
+**Whistle-blowing**
+Renounce to your professional duty and make a sign that something is not
+working, this kind of behaviour is punished by a legal point of view.
+
+#### Collingridge dilemma (Collingridge 1980)
+- It is not possible to predict the consequences of new technologies in the
+  earlier phases
+- Once the negative consequences materialize, it is difficult to change the
+  direction of technological development.
+
+**Constructive Technological Assessment** (CTA) is an approach in which TA-like
+effors are carried out in parallel to technological development.
+

+ 80 - 0
Computer Ethics/lesson_03.md

@@ -0,0 +1,80 @@
+# Computer Ethics - lesson 3
+#### Viola Schiaffonati
+###### 03 October 2017
+### Presentation, papers and more 
+
+To choose the presentation, send an email by 12 october
+
+The topic for the presentation/paper is chosen by the student.
+#### Presentation / paper supervision
+- oct 12
+- nov 9
+- nov 21
+- dec 21
+
+Presentation is 20/30 minutes long, with 5/10 min for Q&A
+It has to be in english
+We can use slides or other support for the presentation (song, dialogue...)
+
+#### Exam dates
+- Jan 31
+- Feb 21
+
+#### Suggestions
+Both paper and presentations must offer an __argument__, we have to support our
+opinion.
+Present reasons for the claims you are making.
+Some originality is required in putting pieces together and develop our own
+ideas.
+
+#### How to choose a topic
+A good paper/presentation makes a __small point__ but makes it clearly and offer
+good reasons.
+
+The paper has to show some __indipendent thinking__
+
+Don't focus on title but on content, *smart titles* are not necessary, chose at
+the end a simple title when the content is already solid.
+
+- The topic must be approved by the instructor, with a provisional title.
+- structure the paper
+- write.
+
+Begin by formulating the __precise thesis__
+- state clearly the thesis in the introduction
+- get to the point quickly and without digression
+- don't try to introduce your argument within a grand historical narrative.
+
+##### Structuring the paper
+
+Define technical or *ambiguous* terms (ex: difference between morality and
+ethics)
+- Think of an imaginary reader that has some knowledge on these topics but is
+  not an expert (ex: colleague of you in this course).
+
+In case of doubts, provide a simple definition, on a footnote.
+
+__Motivate your thesis__, explaining to the reader why he should care about.
+
+Make clear from the beginning the path that i will follow in the argumentation.
+(I will start from this, then discuss on that... and conclude with this)
+
+Explain only the details that are essential
+
+To strenghten an argument it is possible to anticipate and answer objections to
+it
+
+The simple negation of a thesis is not an objection
+
+Bibliography __must be complete__ and __coherent__
+- provide in the bibliography the original reference, even if the resource is
+  found on the web. (Journal, book, issue, number, press institute...)
+
+*Do not* use wikipedia as ultimate source of information on philosophy and
+ethics, instead use __stanford encyclopedia of philosophy__
+plato.stanford.edu
+
+This website has an editor and the articles are written by the most experts in
+the matter (ex: J. van der Hoven)
+
+In case refer to the entry "How to cite this entry"

+ 79 - 0
Computer Ethics/lesson_04.md

@@ -0,0 +1,79 @@
+# Computer Ethics - lesson 4
+#### Viola Schiaffonati
+###### 05 October 2017
+### Values 
+
+#### Intrinsic and instrumental
+- Intristic value: vale in and of itself
+- Instrumental: value because useful for other uses.
+
+Is *privacy* and intrinsic or instrumental value.
+The state of the art is that privacy is an __instrumental value__ to
+indipendence.
+The loss of privacy wound be a threat to our fundamental values.
+
+If a person is being watched by constant surveillance, this determines how the
+person behaves and sees himself.
+
+##### Suggested reading: the circle - Dave Eggers
+
+### Norms
+Norms prescribe what actions are required, permitted or forbidden.
+
+Norms can be seed as tools to realize values
+
+### Virtues
+Virtues are needed to implement Values
+They can be categorized in:
+- moral virtues: justice, honesty, courage
+- intellectual virtues: focus on knowledge and skills
+
+Moral virtues are indispensable in a responsible organization.
+
+### Theories in normative ethics
+__normative relativism__: all moral point of view are equally valid.
+It's a contraddiction in terms:
+> There is no universal norm, but normative relativism is one of it.
+
+__Realism__ states that a reality exists, and is opposed to __skepticism__
+(G.Berkeley, I.Kant, Plato) that doubts the fact that we can experience a real
+world.
+
+> How can i be sure that other people are consciousness?
+
+We have to put a stop to these kind of *skepticism* because otherwise we have to
+negate every form of knowledge.
+
+- Universalism: there is a system of norms that is universally applicable
+- Absolutism: Is a rigid form of universalism in which no exceptions are
+  possible.
+
+We also experiencea gap between __universal values__ and __conflicting norms__
+
+__Utilitarism__: consequences of actions are central to the moral judgement of
+actions (form of *consequentialism*).
+
+Actions are judged by the amount of __pleasure__ and __pain__ they bring about
+(from a society, not an individual perspective)
+
+### Historical roots
+- Jeremy Bentham: focurs on __hedonism__, pleasure is the only thing that is
+  good in itself, and others are instrumental.
+  __moral balance sheet__ in which the costs and benefits are weighted against
+  each others.
+
+- John Stuart Mill: __freedom principle__ (no harm principle): everyone is free
+  to strive for his pleasure as long as you don't deny others pleasure.
+
+### Criticism to utilitarianism:
+- How can you measure happiness objectively
+- Utilitarianism can lead to *exploitation*
+- Consequences may be unpredictable (in particular with technology)
+- ignores the personal relationships
+
+### Duty ethics
+Also known as deontological ethics: action is considered morally right if it is
+in agreement with a certain moral rule, which can be:
+- given by God (bible,koran)
+- Social contract
+- Reasonable arguments

+ 6 - 0
Computer Security/genpdf.sh

@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+# Packages needed:
+# pandoc, texlive-core, texlive-latexextra 
+
+cat lesson_*.md | pandoc --latex-engine=xelatex -o course.pdf

+ 2 - 0
Computer Security/lesson_01.md

@@ -89,3 +89,5 @@ For example when McDonalds launched in Italy (1996) it used as a marketing strat
 But over time they changed their image moving from the USA image to a more local image,
 and this operation changed their threat level because before there were more people pissed off by America
  that burned flags, threw rocks at the USA embassy and burned down McDonalds. 
+
+

+ 1 - 0
Computer Security/lesson_04.md

@@ -38,3 +38,4 @@ There is a whole research field about "What you see is what you sign"
 - Something that you are: Face, voice, fingerprints.
 
 Usually some of the three measures are combined, example: two factor authentication
+

+ 1 - 0
Computer Security/lesson_05.md

@@ -44,3 +44,4 @@ Financial Crypto 2016 - How google killed 2factor authentication
 
 ## Single Sign On
 Google, Yahoo, Facebook can be used as identity providers.
+

+ 1 - 0
Computer Security/lesson_06.md

@@ -41,3 +41,4 @@ The last developement in the sector was the introduction of __bug bounties__
 ## Conclusion
 Volnerabilities may be __dense__ so taking out one vulnerability does not make the software
 more secure.
+

+ 1 - 0
Computer Security/lesson_07.md

@@ -75,3 +75,4 @@ We can reduce the need of precision filling the heap area with `nop`
 forming a *nop sled* that make the processor go through to the right exploit code.
 This is a measure to make the exploit work reliably on remote machines,
 ans this is part of __weaponizing__ an explloit
+

+ 1 - 1
Computer Security/lesson_09.md

@@ -30,7 +30,7 @@ The main cause are programming errors
 is checked to make sure the buffer was not exploited
 (Reference from canaries used by miners)
 Static canaries can be easily replaced, there are
-more effective tecniques like __Terminator canaries__ (made of \0)
+more effective tecniques like __Terminator canaries__ (made of `\0`)
 and __Random canaries__
 If we seek performance we may disable canaries by NOT using `-fstack-protector`
 Buf for normal programs it should stay enabled.

+ 1 - 0
Computer Security/lesson_10.md

@@ -46,3 +46,4 @@ and the target value (length) that we want to write in memory.
 
 The simple `%n` overflows and writes always 4bytes word, to write
 16 bits at a time we can use `%hn`
+

+ 1 - 0
Computer Security/lesson_11.md

@@ -24,3 +24,4 @@ __XSS__ or __cross site scripting__ is the technique of putting in a textbox
 a javascript executable code marked as `<SCRIPT>` that will be executed in
 the client and violate the __SOP__ policy to access data or perform operations
 on the attached site from the client.
+

+ 1 - 1
Computer Security/lesson_13.md

@@ -1,6 +1,6 @@
 # Computer Security - lesson 13
 #### Stefano Zanero
-###### 15 May 2016
+###### 19 May 2016
 ## Web Security pt.3
 The debug messages of dbms when left enabled are very useful to an attacker
 Because this *information disclosure* brings a lot of useful data.

+ 23 - 0
Computer Security/lesson_14.md

@@ -0,0 +1,23 @@
+# Computer Security - lesson 14
+#### Stefano Zanero
+###### 20 May 2016
+## Network protocol attacks
+The three common types of attacks are:
+- Denial of Service: service unable to serve users
+- Sniffing
+- Spoofing
+
+### Denial of Service
+A __Killer packet__ is capable of bringing down the machine which is sent to.
+Ping-o-death(ICMP) and Teardrop(TCP) Were two vulnerabilities with
+the same principle of just handling cases provided by the standard,
+and not handling abnormal or erroneous packets.
+
+Attacks like __smurf__ are hardly fixed because the ones that have interest
+of fixing the vulnerability are not the same ones that need to spend
+the money in order to fix it.
+
+### Sniffing
+Switched networks as opposed to hub-based networks send to every host
+only the packets that are destined to it, and also are faster.
+

+ 14 - 0
Computer Security/lesson_15.md

@@ -0,0 +1,14 @@
+# Computer Security - lesson 15
+#### Stefano Zanero
+###### 26 May 2016
+## IP Address Spoofing
+The fact that IP addresses can be spoofed is a fact due to the design of the IP protocol
+But not necessarily is going to be a vulnerability,
+if for example on the application level i question the truthfullness of the sender
+address, it is not a problem anymore.
+
+The simple TCP three way handshake, having randomizing SEQ numbers, offer
+a protection against IP spoofing, in fact if the attacker does not get the
+SYN+ACK packet, he cannot begin a connection.
+
+

+ 44 - 0
Computer Security/lesson_16.md

@@ -0,0 +1,44 @@
+# Computer Security - lesson 16
+#### Federico Maggi
+###### 9 June 2016
+# Network Security / SSL
+
+__exercize__: Try to write the firewall rules for a DMZ multizone architecture
+
+## VPN Networks
+A VPN can act in two modes:
+- Full tunnelling: all the traffic of the client is tunnelled through the VPN
+- Split tunnelling: only the connections towards the corporate network are routed through the VPN.
+
+The full tunnelling wastes more bandwidth but instead the split tunnelling creates a bridge 
+between an unprotected network and a protected one.
+
+# Exam Preparation
+
+__Ex. 1__ True or False statements
+- RSA 2048 is more robust to bruteforcing than 256 AES
+False, we can not compare directly an asymmetric RSA and symmetric AES
+
+- No encryption algorithm is perfect, as they are all vulnerable to bruteforcing
+False, because OneTimePad is invulnerable to bruteforcing because every cyphertext decrypts to every possible plaintext
+
+- An encryption algorithm is broken if there is a way to get the secret by using the cyphertext
+False, an algorithm is broken if there is an attack significantly faster than bruteforcing.
+
+__Ex. 2__
+To avoid Buffer overflow we can
+- Use a secured version of the `gets()` like `read()` specifying number of bytes to read
+- Use a `for` cycle to read char by char
+- Use a `scanf()` specifying %15c
+
+__Ex.3__
+Assuning IA-32, why must we split the content to be written in the target cell in 2, 2-bytes chunks?
+Because %c allows to print up to 64K chars (16bits)
+
+The printf is vulnerable only in the case that the format string is variable and can be used to write
+an exploit, if it is fixed in the source code, it cannot be exploited.
+
+__Ex.4__ on SQL injections
+
+__Ex.5__ ICMP Smurf attack
+

+ 44 - 0
Computer Security/lesson_17.md

@@ -0,0 +1,44 @@
+# Computer Security - lesson 17
+#### Stefano Zanero
+###### 16 June 2016
+
+# SSL Security
+
+## New protocol adoption
+Every time a new protocol needs to be adopted, it is a critical problem the critical mass question.
+This can be a major problem for startups/business plans that aim to replace a big player
+with a new, better system.
+
+## SSL
+__Phases__:
+- cipher suite + random data
+- certificate verification
+- pre-master key exchange
+- pre-master key encryption (and optional signing)
+
+The signing of the master key by the user authenticates it but it is an optional feature
+and nobody uses it (99%) so the majority of the times the client is not authenticated.
+
+The exchange of random data in SSL is used to ensure __freshness__ of the communication,
+that is used to avoid __replay attacks__ in which a malicious server replays the
+exact messages of an old communication and establishes a connection.
+
+### Man in the middle
+A simple man in the middle attack can't get the content of a connection because it doesn't 
+know the server private key.
+
+## SET system
+Meant to protect __transactions__ not __connections__
+
+SET story was used by VISA and MasterCard to give the resposibility of transaction frauds
+entirely to merchants, because they offered a secure alternative but the merchants
+decided it was not economically convenient to adopt.
+
+# Malware
+
+Categories:
+- Virus: is not an executable but a piece of code able to infect programs and self propagate
+- Worm: is an executable for of virus
+- Trojan Horse: Is a program that seems useful or innocent but hides malicious behaviour
+like creation of remote access.
+

+ 32 - 0
Computer Security/lesson_18.md

@@ -0,0 +1,32 @@
+# Computer Security - lesson 18
+#### Stefano Zanero
+###### 17 June 2016
+
+# Viruses
+Look for ted talk history and viruses.
+
+From 2004 on the production of worms stopped because the people that
+were developing worms put themselves in business and began creating
+ransomware, scareware and state-sponsored malware.
+
+__Ransomware__ is a form of getting money from malware.
+
+Most computer viruses are not harmful because a virus that takes
+down the host as soon as it's infected, cannon propagate.
+For example cold infection is a lot more effective than ebola
+because it does not kill you and let you propagate it.
+
+Before the introduction of macro viruses, people were trained
+on the fact that office documents were harmless and could
+be opened safely, but after introduction of macro language
+in office, macro viruses began to spread.
+
+TCP connection are latency bound, so the more is loaded one of the host,
+the slower the connection will be.
+So TCP based viruses like code-red were slowing down themselves.
+But UDP based viruses like SQL hammer are much more effective.
+
+SQL hammer was based on the assumption that there were databases exposed on
+the internet while they didn't have any reason to be.
+
+

+ 32 - 0
Computer Security/lesson_19.md

@@ -0,0 +1,32 @@
+# Computer Security - lesson 19
+#### Stefano Zanero
+###### 23 June 2016
+# Antivirus and Anti-malware
+
+Commercial products for antivirus employ __signature based detection__ or __heuristics__
+but they never apply __behavioral detection__ that is limited to the research field.
+This is basically because commercial products are focused on __detecting__ malware
+and not __analyzing__ its behaviour.
+
+## Viruses and Worm stealth techniques.
+
+- __Polimorphism__ is when the virus changes its shape with every infection,
+for example encrypting the malicious payload every time with a different key.
+The problem in this case for analyzers is that often signatures recognize
+the dectyptor code and not the malicious code, so one signature mathes 100s viruses.
+
+- __Packing__ is used by malware to encrypt the code but also used my DRM software.
+
+# Rootkits
+The word __rootkit__ originally meant the set of software to gain root access and 
+maintain it on a machine.
+
+__Userland__ rootkits would require trojanize lots of utilities that otherwise could
+be used to detect the attack, like `ls, du, netstat...`
+
+It is much simpler but more difficult to have a __kernel__ exploit.
+
+For computers it is a very important issue the __supply chain__, or the fact that
+you cannot ensure that the vendors of all the components of your computer 
+or the oem vendor haven't compromised your device.
+

+ 172 - 0
Cryptography/exe_01.md

@@ -0,0 +1,172 @@
+
+If the frequency graph has the same shape of the english language,
+it is a permutation cipher, if the shape is the same but labels are different, 
+it is a substitution cipher, or a combination of the two.
+
+The permutation cipher does not affects the frequency graph because the analisys
+is done on the text as a whole which ignores the scrambling.
+
+Growing the keylenght in a vigenere cipher, i expect to see the frequency curve
+flattening, until it become completely flat when the key is long as the text
+(one time pad)
+
+To have a bigram that remains from the plaintext to the cyphertext, the
+beginning of the n-grams should be aligned with the key.
+
+If in a vigenere cipher we have the frequencies 6, 24, 30
+the key lenght candidates are 3, 6, 2,1. We start loogin from the longest key.
+
+If the vigenere is using a key lenght of 3 and i pick 6, i will still find a key
+with is a double repetition of 3 lenght key.
+
+### SMS example
+If i'm encrypting sms messages (160bytes) with a 256B key:
+- if I use every time a different key, the cipher is not breakable because is
+  akin to a onetimepad.
+- if I use always the same key I will be using actually 160bytes of the key, so
+  it's a matter of collecting enough ciphertexts and concatenating them to run a
+  classic vigenere breaking
+
+__Unicity distance__:
+Even if we are using bruteforce, if we have less that the unicity distance in
+ciphertext, i will be unable to tell apart the actual plaintext from a group of
+texts that pass the test.
+
+Defined as: $n_0 = {log_2{|k|}/{R_L * log2{|M|}}$
+
+Redundancy $R_L = 1 - {H_L}/{log_2{|M|}}$
+
+Entropy of english $H(M) \le 1.5b$
+
+- Best case, 
+the message has an extremely redundant message, 
+
+High redundancy what dinstinguishes english from random data.
+
+With more redundancy is is more difficult to distinguish a meaningful message
+from one that it isn't.
+
+Entropy of a random (lowercase) letter $H(rnd letter) = -\Sum{s}p_s * log(p_s)$
+$- (26*1/26 * log(1/26)) = log_2(26)$
+$$log_2(16) < log_2(26) < log_2(32)$$
+
+So using lowercase letters as key I have an entropy of 160b, between 640 and
+800.
+
+$$n_0 = \frac{log_2(|K|)}{R_L * log|M|}$$
+$$n_0 = \frac{800)}{0.75 * 4.7}$$
+$$n_0 = \frac{800}{3.5}$$
+$$n_0 = 200$$
+
+I need at least 2KB of text to at least get a unique plaintext when doing
+bruteforce.
+
+__Honey encryption__
+Takes a meaningful plaintext and a source of random number, and outputs a 
+uniform distribution of characters, which even when bruteforcing decrypts to a
+bunch of random numbers.
+This encryption scheme is used in credit cards to avoid the risk of bruteforce
+attacks.
+
+__Playfair cipher__
+- Start with a 5x5 grid
+- Fill with keyword, avoiding letters already present
+- Fill with english alphabet, still avoiding repetitions.
+ W | I | N | T | E
+---|---|---|---|---
+ R | M | U | A | B
+ C | D | F | G | H
+ K | L | O | P | Q
+ S | V | X | Y | Z
+
+ I take the plaintext *crypto*
+Take two letter and replace them with their neighbors
+>>> Missing encryption procedure
+
+ The keyspace is $25!$ because it is a still a permutation of the english 
+ letters even if it is folded.
+
+$$ln(n!) = nln(n) - n + O(ln(n))$$
+Shorthand formula
+$$n! = e^(nlog(n)) - e^n + e^log(n)$$
+
+$$25! -> 25*4 ~= s^120$$
+
+Bruteforce reference
+Powers of two:
+- 0-40 laptop
+- 40-50 GPU
+- 50-60 bunch of GPUs
+- 60-70 calculus center
+- more than 80 unlikely
+- 100 the energy obtained burning all the oil is not sufficient.
+
+The table rule is encrypting a digram into a given digram, so I can use a large
+lookup table to compare the digrams.
+
+__Nihilist cipher__
+A variation of the playfair cipher used by the U.S. war prisoners,
+Has two keys:
+- k1: build the polybius square
+- k2: run it through the table
+ * for example "chair" look it up in the square and report the coordinates
+ 31-33-24-12-21
+
+Procedure
+- Run the plaintext through the table
+PTX= "Test"
+14-15-51-14
+- Add the key (non modular) to the plaintext
++ 31-35-24-12
+45-50-75-26
+
+Is the thing breakable? what is the keyspace? can i run a bruteforce?
+The two keys are independent so I will need to bruteforce both of them.
+__Keyspace__
+The second key will be the entropy of a symbol times the number of symbols
+The keyspace of the first key is 25! as before
+
+The first encoding can be seen as a funny substitution cipher
+Also there's a bias in the number, it is more frequent to find higher numbers,
+I can compare the distribution of cyphertext histogram to the plain english one.
+
+In the playfair cipher, a letter can be never envrypted as itself.
+
+__Enigma__
+The enigma machine had three cogs that applied three substitutions and again in
+reverse order thanks to a reflector.
+A peculirarity was that the signal of a letter could never be sent back to the
+same letter because it would cause a short circuit.
+
+The only position that mattered was the first one because the remaining
+positions were obtained by rotating the rotors.
+The commercial version of enigma has three rotors, or 26³ keyspace,
+While an enhanced version has three rotors to be picked out of 5
+thus getting a 26³*5*4*3
+The plugboard added a 26*24*23...*15
+This is more than was done by the rotors alone, and a version with 10 cables was
+introduced by just adding more cables.
+
+A contradiction is when a single ciphertext letter gets mapped to wto different
+letters, with can't be done in a single wiring machine.
+The military version had a plugboard with 26 sockets and 6 cables.
+
+6 face die
+3 random variables
+- x = {1...6}
+- y = {odd, even}
+- z = {result<=3, result>3}
+
+Compute the entropy of these guys and at least the joint entropy of (x,y), (z,y)
+H(x) = -6*1/6*log2(1/6i)= log2(6)
+Rolling a dice gives 2.6b of entropy
+H(y) and H(z) gives 1bit of entropy, the dice become equivalent to a coin
+
+H(xy) 
+We make the table of the thwo wariable, so the joint entropy of XY is as Y,
+because there is a correlation
+
+H(zy) gives a different correlation
+
+
+

+ 12 - 0
Cryptography/lesson_01.md

@@ -0,0 +1,12 @@
+# Cryptography
+#### Gerardo Pelosi
+###### 6 March 2017
+
+---
+
+## Introduction to Cryptography
+Encrypting is different from encoding:
+- encoding is meant to protect the information from errors
+- encryption is meant to protect the comunication content
+
+

BIN
Game Theory/.lesson_03.md.swp


+ 23 - 0
Game Theory/lesson_03.md

@@ -0,0 +1,23 @@
+# Game Theory - lesson 3
+#### 
+###### 12 October 2016
+## Extensive form
+
+### Example
+Three politicians must vote if to raise or not their salaries.
+Vote is public and in sequence. All of them want to raise the salaries
+but would like to vote against.
+
+#### Main Features
+1. The moves are in sequence
+2. Every possible situation is known to the players.
+At any time they know the past history and the possible developments.
+
+The complete game can be represented as a tree
+- The vertex representing the initial situation
+- The leaves representing the final situations of the game
+
+### Backward Induction
+We start from the final situation and we go back to the initial situation.
+A finite lenght is required for the game.
+

+ 17 - 0
OR/lesson_01.md

@@ -0,0 +1,17 @@
+# Operations Research - lesson 2
+#### Federico Malucelli
+###### 26 Sept 2017
+## Problems modeling
+
+---
+
+algorithm:
+- sort the indices by $\frac{c_i}{a_i}$
+- $remaining_budget \leftarrow b$
+- i<-1
+- repeat
+    * $y_1 \leftarrow min {1, \frac{remaining budget}{a_i}}$
+    * $remaining_budget \leftarrow remaining_budget - a_i*y_i$
+    * $i \leftarrow i+1$
+- until $i=n+1$ or remaining_budget = 0
+

+ 6 - 0
Piattaforme Software per la Rete/MOD1/genpdf.sh

@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+# Packages needed:
+# pandoc, texlive-core, texlive-latexextra 
+
+cat lesson_*.md | pandoc --latex-engine=xelatex -o course.pdf

+ 14 - 0
Piattaforme Software per la Rete/MOD1/lesson_00.md

@@ -0,0 +1,14 @@
+---
+fontsize: 12pt
+---  
+
+# Piattaforme Software per la Rete
+
+### Modulo 1
+    
+# Giacomo Verticale
+
+\pagebreak
+
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD1/lesson_01.md

@@ -130,3 +130,6 @@ Questo obiettivo non è stato pienamente perseguito, a causa della scelta del da
 - __prestazioni__
 - __mobilità__ (spostamento continuo)
 - supporto al __nomadismo__ (collegamento in posti diversi)
+
+
+

+ 1 - 0
Piattaforme Software per la Rete/MOD1/lesson_02.md

@@ -96,3 +96,4 @@ l'hypervisor facendo calcolare i checksum alla scheda di rete, a cui però i pac
 Quindi in questo modo si aveva un tasso di errore sui pacchetti molto alto.
 
 
+

+ 3 - 0
Piattaforme Software per la Rete/MOD1/lesson_03.md

@@ -46,3 +46,6 @@ __Tcpdump__ stampa pacchetti in stdout, e può salvare pacchetti in file pcap
 __Wireshark__ dispone di filtri aggiuntivi per riconoscere traffico a livello applicativo.
 I pacchetti salvati nel formato pcap vengono tagliati ai primi 64byte ad esempio per salvare solo gli header utili
 senza memorizzare tutto il pacchetto sprecando spazio.
+
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD1/lesson_04.md

@@ -65,3 +65,6 @@ che era in grado di fare ricerca in parallelo in hardware.
 MAC 48bit A(x)=a0x^47+a1x^46+...+a46x+a47 Sono i bit del mac address
 H(x)=A(x)M(x)modG(x)
 output,input,parametro che determina una specifica funzione hash
+
+
+

+ 2 - 0
Piattaforme Software per la Rete/MOD1/lesson_05.md

@@ -125,3 +125,5 @@ devo esploderli in più nodi di lunghezza intera. (1*3bit -> 2*4bit)
 Se ho una tabella data, esiste un passo che ottimizza i tempi di accesso
 Però gli inserimenti sono critici perchè si sposta il punto di ottimo.
 
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD1/lesson_06.md

@@ -133,3 +133,6 @@ flusso minore e hanno più tempo per classificare i pacchetti, quindi:
 
 ### BPF 
 PacketFilter usato negli host in modo efficace, ma molto lento se usato nei router.
+
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD1/lesson_07.md

@@ -33,3 +33,6 @@ Ci sono varie versioni in base al numero di CPU:
 Si presentano pacchetti in cui i *lookup*sono fatti già sulle line card, 
 non sovraccaricando la CPU che gestisce solo il piano dati.
 Un'altra soluzione è avere una __matrice crossboard__
+
+
+

+ 2 - 0
Piattaforme Software per la Rete/MOD1/lesson_08.md

@@ -55,3 +55,5 @@ Fasi dell'algoritmo:
 se un uscita riceve richieste da più porte di ingresso, ne sceglie una a caso.
 - Accept: Ogni ingresso sceglie un uscita, se ce ne sono multiple viene scelta a caso.
 
+
+

+ 2 - 0
Piattaforme Software per la Rete/MOD1/lesson_10.md

@@ -127,3 +127,5 @@ a ogni foglia una stringa di W-log2N bit
 (W-log2N)N/2+N/2-1
 O(W*N)
 
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD1/lesson_11.md

@@ -86,3 +86,6 @@ ID flusso per servizi destinazione = IPdst||proto||portdst
 Dall'ID del pacchetto calcolo tre funzioni di hash e inserisco i tre risultati in array diversi
 Se A1[h1(f)>T e così via per tutte le funzioni e array, allora salvo il flusso F
 Se il numero di pacchetti nel flusso F supera T allora Ai[hi(f)>T
+
+
+

+ 2 - 0
Piattaforme Software per la Rete/MOD1/lesson_12.md

@@ -41,3 +41,5 @@ Il primo nodo che campiona un pacchetto scegliendono a caso utilizza una *firma*
 del pacchetto, usando una concatenazione dei campi del pacchetto (che non cambiano
 da nodo a nodo) in modo da ottenere un valore specifico di quel pacchetto.
 
+
+

+ 1 - 0
Piattaforme Software per la Rete/MOD1/lesson_13.md

@@ -99,3 +99,4 @@ Per realizzare l´ architettura necessaria devo:
     - IETF cosniglia RSVP-TE
 
 
+

+ 0 - 1
Piattaforme Software per la Rete/MOD1/lesson_14.md

@@ -140,5 +140,4 @@ La tabella con indice massimo non puó avere istruzione GOTO, questo garantisce
 per ogni pacchetto.
 
 
-    
 

+ 144 - 0
Piattaforme Software per la Rete/MOD1/lesson_15.md

@@ -0,0 +1,144 @@
+# Piattaforme e Software per la rete - lezione 15
+#### Giacomo Verticale
+###### 24 May 2016
+## BGP - Border Gateway Protocol
+I due protocolli piú complessi di internet che tengono in piedi la rete sono
+TCP e BGP.
+Permette di esprimere delle esigenze di collegamento degli operatori
+di tipo economico e non solo di ottimalitá del percorso.
+
+### Scopo
+> Comunicare informazioni sulle reti
+Per IPv4 rete=a.b.c.d/n
+Da quando non esiste piú l'indirizzamento a classi,
+si usa il termine rete per indicare un blocco di indirizzi,
+a prescindere che questo corrisponda ad una rete fisica o meno.
+
+agisce 
+- tra Sistemi autonomi (AS) - __eBGP__ (BGP esterno)
+- entro un sistema autonomo - __iBGP__ (BGP interno)
+
+### Architettura di internet
+Un insieme di reti forma un __sistema autonomo__
+é un insieme di reti gestiti dalla stessa entitá organizzativa
+o piú specificatamente, un insieme di reti in cui il routing
+viene effettuato in modo uniforme.
+Protocolli di routing interni:
+- RIP
+- OSPF
+Distribuiscono all'interno della rete le informazioni sulla raggiungibilitá.
+
+Un approccio di questo tipo non scala per reti molto grandi perché:
+- Diverse reti magari concorrenti non vogliono diffondere informaizoni
+sulla topologia interna
+
+I sistemi autonomi comunicano tra di loro tramite il protocollo eBGP.
+Le informazioni vengono propagate da un sistema autonomo verso i propri vicini e cosí via.
+
+Un informazione BGP comprende tutti i sistemi autonomi da attraversare per raggiungere 
+una destinazione, non vengono fornite informazioni sul routing all'interno del 
+sistema autonomo.
+Le Informazioni BGP vengono comunicate all´ interno dell'autonomous system tramite iBGP.
+
+__Come fa a funzionare BGP se esso stesso serve al routing__
+- eBGP funziona solo tra nodi next-hop collegati a livello 2,
+quindi non servono particolari informazioni di routing.
+- iBGP lavora all'interno del sistema autonomo dove sono giá presenti informazioni
+di routing, fornite ad esempio da OSPF.
+
+__Fasi del routing completo__
+- Protocolli interni (OSPF,RIP) effettuano il routing interno
+- iBGP si instaura sul sistema autonomo
+- eBGP propaga le informazioni tra sistemi autonomi.
+
+BGP usa TCP, e ne ricava una indicazione di affidabilitá del percorso:
+Se la connessione TCP non é in piedi, il percorso non é disponibile.
+
+BGP usa un approccio DV_like (distance vector) chiamato __path vector__
+ perché sarebbe complicato distribuire informazioni su miliardi di nodi
+e alcuni agenti non vogliono distribuire informazioni sulla topologia di rete.
+A differenza del distance vector vengono inviate informazioni
+sulla lista di sistemi autonomi da attraversare per raggiungere la destinazione.
+
+### Esempio di comunicazione BGP
+Destinazione | S.A. da attraversare
+---|---
+N1 | {R1,ASx,ASy,..}
+N2 | router di entrata nell'AS
+
+costo rotta = n' AS attraversati
+Il costo di attraversameto di un sistema autonomo é cosí alto che si contano
+solo i sistemi autonomi attraversati.
+
+Per scoraggiare un percorso, il sistema autonomo puó inserire se stesso piú volte
+nella lista, in modo che il percorso risulti piú lungo (usato per rotte di backup
+magari tariffate a consumo)
+
+### Messaggi BGP
+Esistono messaggi chiave e messaggi opzionali che possono essere implementati o meno
+
+- OPEN - __apre sessione__: viene dichiarato il numero del sistema autonomo, e se i numeri
+dei due interlocutori sono uguali si usa BGP interno, altrimenti esterno
+- UPDATE - __propaga o ritira informazioni su un prefisso__: viene usato per 
+distribuire informazioni sulle rotte.
+- KEEPALIVE - __verifica raggiungibilitá dell'host__: TCP non é in grado di capire 
+se l'host remoto é ancora vivo, questa cosa viene lasciata al protocollo applicativo.
+- NOTIFICATION - __chiude la sessione__: Notifica che l'entitá sta andando in 
+*mainteinance*
+- ROUTE REFRESH...
+
+Nel momento in cui un BGP speaker (router che usa BGP) riceve un update, deve 
+ridistribuirlo ai suoi vicini, e questo avviene in modo differente tra eBGP e iBGP.
+Una funzionalitá importante di BGP sono le politiche di __filtering__ che permettono 
+di distribuire in modo selettivo o non distribuire alcune informazioni.
+__Regole__:
+- regola 0: Quando si redistribuisce con eBGP si aggiunge in testa al percorso
+il proprio _numero di AS_.
+- regola 1: 
+    1. Si redistribuiscono via iBGP i percorsi ottenuti tramite eBGP
+    2. Si redistribuiscono via eBGP i percorsi ottenuti tramite iBGP
+- regola 2: Non si redistribuiscono via iBGP i percorsi ottenuti tramite iBGP
+(evita che un router riceva un informazione piú volte).
+Questo implica che tutti i router di un A.S siano connessi a maglia completa,
+altrimenti il pacchetto non raggiungerebbe tutti i router.
+ 
+### Path attributes
+Vengono propagati insieme all'annuncio
+
+__Struttura annuncio__
+
+Prefisso | contenuto
+---|---
+PATH | lista di AS + router di entrata
+ATTRIBUTI | ...
+
+__Path attributes__
+- ORIGIN:
+    - IGP: inserito da un IGP (Gateway = vecchio nome dei router)
+    - EGP: inserito da EGP (non usato piú da anni)
+    - incompleto: inserito a mano
+- AS-PATH
+- NEXT-HOP
+- MULTI-EXIT DISCRIMINATOR (solo in eBGP): esprime la preferenza di inviare pacchetti
+nella strada con MED piú basso.
+- LOCAL PREF (solo in iBGP): é l'analogo del MED internamente al S.A. permette di 
+usare il link tra A.S che si preferisce (LOCAL PREF piú alta).
+
+I pacchetti seguono il percorso inverso dell'annuncio, perché questo consiste 
+nella disponibilitá a ricevere pacchetti entranti.
+
+### BGP speaker
+- Adjacent RIB-IN: Memorizza i dati in una tabella diversa per interlocutore, 
+(memorizza tutte le informazioni ricevute, non é la tabella di routing,
+ ad esempio puó contenere doppioni).
+- Import: esegue filtraggi specificati dall'amministratore
+- Route selection.
+- Tabella di routing.
+- Export (filtrano le informazioni da propagare)
+- RIB-OUT
+
+Filtri di export usati ad esempio per accordi di *peering* che sono gratuiti e permettono
+a due ISP di scambiarsi i pacchetti diretti per l'altro ma non quelli diretti a terzi.
+
+
+

+ 120 - 0
Piattaforme Software per la Rete/MOD1/lesson_16.md

@@ -0,0 +1,120 @@
+# Piattaforme e Software per la rete - lezione 16
+#### Giacomo Verticale
+###### 27 May 2016
+## BGP Decision Process
+1. Ricezione update dai vicini (inserimento in *ADJ-RIB-IN*)
+2. Applicazione filtri import
+3. Scelta del percorso migiore (inserimento in *LOC-RIB*)
+4. Per ogni vicino: 
+    - aggregazione delle rotte, 
+    - applicazione filtri export, 
+    - inserimento in ADJ-RIB-OUT
+5. Invio UPDATE
+### Algoritmo per la scelta del percorso migliore:
+Questo algoritmo non ha nessuna garanzia di convergenza, quindi risulta necessario
+garantire la presenza di un amministratore 24/7 per sistemare eventuali problemi.
+
+1. Massima LOCAL-PREF
+2. Scegli percorsi originati localmente
+3. AS_PATH piú corto
+4. minima ORIGIN (IGP < EGP < INCOMPLETE)
+5. minimo MED
+6. Preferisci eBGP su iBGP
+7. Minimo costo verso il NEXT-HOP
+8. Se i percorsi sono tutti esterni, tieni il piú vecchio
+9. Scelgo il percorso annunciato dal router con ID minimo
+(potrei scegliere a caso, scelta deterministica per evitare route-flapping)
+(ID ROUTER = Indirizzo IP piú grande)
+
+### Relazioni di organizzazione di internet
+Fino a qualche anno fa le relazioni tra A.S. erano del tipo
+- customer/provider in cui un A.S paga un altro per risolvere le connessioni
+- peering in cui si scambiano traffico proveniente dai sottoalberi
+(ultimamente si é parlato di peering a pagamento per A.S. di dimensioni diverse
+
+I seguenti non sono standard ma best practice
+Tipo di A.S. | Preferenza | Export Filter
+--- | --- | ---
+Customer | Massima prioritá | Inviato a tutti gli A.S. vicini
+Peer | Media | Inviato a tutti gli A.S. customer
+Provider | Minima | Inviato a tutti gli A.S. customer
+
+__Teorema__
+> Se tutte le regole di filtraggio sono in accordo con le regole della tabella,
+> allora il routing é stabile (non succede *route flapping*)
+
+Da qualche anno a questa parte il classico schema gerarchico (Tier 1/2/3) é stato
+cambiato dall'introduzione di __Content Provider__ che generano una grande quantitá
+di traffico, ed effettuano accordi di peering a vari livelli permettendo 
+ai provider di avere latenze piú basse e bandwidth maggiori.
+
+Un esempio di __Content provider__ sono Netflix, Google, YouTube... perché generano 
+traffico, ad esempio Netflix negli stati uniti genera il 45% di traffico usato.
+
+Akamai invece é un __Content Delivery__ service, cioé non genera contenuto ma
+si occupa di fare accordi per distribuirlo.
+
+Questo si inserisce nel discorso sulla __net neutrality__ per cui ci si chiede
+se i contenuti dei content provider vengono trattati alla pari del traffico generato
+da altri customer.
+
+## Esercizio su OpenFlow
+- Uno switch S1
+- Tre host h1,h2,h3
+
+MAC h1=00:00...:01
+IP h1=10.0.0.1
+
+Funzione che gestisce event switch features:
+```
+...
+match = parser.OFPMatch()
+actions = [ parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,ofproto.OFPCML_NO_BUFFER)]
+...
+invia flowmod a s1 con prioritá 0
+```
+```
+match = parser.OFPmatch(eth_dst="00...3")
+actions = [parser.OFPAction Output(3)]
+invia flowmod con prioritá 1
+...
+match = parser.OFPmatch(eth_type=0x800,ip_dst="10.0.0.3")
+actions = [output 3]
+invia flowmod con prioritá 2
+```
+
+Il gestore della packet-in da un comando packet-out in flooding.
+
+__Domande:__ 
+- simulare:
+    - h1 ping h2, 
+    - h1 ping h3,
+    - apertura connessione TCP da h2 a h3 (porte 123,80)
+
+__Switch__
+ 
+Prioritá | Match | Azione | Pkt counter
+--- | --- | --- | ---
+0 | * | output controller | 0
+1 | eth_dst=0...3 | output 3 | 0
+2 | eth_type=0x080 IP_dst=IP3 | - | - 
+
+__h1 ping h2__
+- *h1->s1*: MAC 1, MAC BROADCAST, ETHTYPE=ARP, IP 1, IP 2
+- *s1->C*: (OF)PACKET_IN (pacchetto precedente)
+- *C->s1*: (OF)PACKET_OUT(stesso pacchetto, action output=FLOOD)
+- *s1->h2*:
+- *s1->h3*:
+- *h2->s1*: MAC 2, MAC 1, ETHTYPE=ARP, IP 2, IP 1
+- *s1->C*: PKT_IN(...)
+- *C->s1*: PKT_OUT(...)
+- *s1->h3*:
+- *s1->h1*: 
+- *h1->s1*: MAC 1, MAC 2, IPv4, IP 1, IP 2, ICMP
+- *s1->C*:
+- *C->s1*:
+- *s1->h2*:(...)
+- *s1->h3*:(...)
+
+
+

+ 87 - 0
Piattaforme Software per la Rete/MOD1/lesson_17.md

@@ -0,0 +1,87 @@
+# Piattaforme e Software per la rete - lezione 17
+#### Giacomo Verticale
+###### 31 May 2016
+
+# Esercizio OpenFlow
+
+__Switch__
+Prio | Match | Action
+--- | --- | ---
+0 | * | out controller
+1 | eth_dst=MAC3 | out 3
+2 | eth_type=IPv4 ip_dst=IP 3 | out
+
+__Packets__
+- h1 ping h2
+- h1 ping h3
+- h2 apre conn TCP verso h3
+
+__Hyp: tabelle ARP giá piene__
+- h2 -> s1 MAC2, MAC3, IPv4(0x0800), IP2, IP3, TCP(6)
+Il pacchetto viene ricevuto dal controllore che controlla sulla tabella, 
+il pacchetto fa match sulla terza riga perché ha prioritá piú alta.
+- s1 -> h3 ...
+- h3 -> s1 MAC3, MAC2, IPv4, IP3, IP2, TCP, 80, 123, SYN ACK
+- s1 -> C packet_in (...) / c -> s1 packet_out (...), action out flood.
+- s1 -> h1, h2...
+
+# Esercizio 2 OpenFlow
+__Topologia__
+h2,h1 - s1 - s2 - h3,h4
+
+__Event OFP Switch Features__
+```
+match su *
+actions = [output su controller]
+priority = 0
+FLOW MOD(datapath, priority, match, ...)
+```
+Datapath é sinonimo di switch, anche se uno switch puó contenere
+piú datapath e agire come piú switch in uno solo.
+Questo é un table miss perché fa match su ogni cosa e ha prioritá 0
+
+```
+match su eth_dst="FF:FF:....:FF"
+actions = [output su flood]
+FLOW MOD(datapath, priority=1, ...)
+```
+
+__Event OFP Packet In__
+Questa funzione serve a recuperare i metadati come la porta in ingresso.
+Se il match non venisse trovato, alla variabile viene assegnato `none`
+```
+in_port = msg.match ['in_port']
+pkt = packet.Packet(data = msg data)
+if len(pkt.protocols)>=2 and is instance (pkt.protocols[1], IPv4):
+    if datapath.id == 1 and pkt_ipv4.dst == '10.0.0.3':
+        match = OFPMatch(eth_src = eth.src, eth_dst=eth.dst,
+                         eth_type = IPv4, ip_dst = '10.0.0.3')
+        actions = [ OFPAction.SetField(ip_dst='10.0.0.2'),
+                    OFPAction Output(2) ]
+        FLOWMOD(match, priority=1, ...)
+else packet_out(FLOOD)
+```
+La porta in ingresso serve per effettuare il flooding di un pacchetto 
+proveniente dal controllore, senza rimandarlo nella porta di ingresso.
+
+- da h1 ad h3 pacchetto UDP 53
+- da h3 ad h2 apertura di connessione TCP/80
+
+__Tabella s1__
+0 | * | controller
+--- | --- | ---
+1 | eth_dst=FF:FF...:FF | output FLOOD
+__Tabella s2__
+0 | * | controller
+--- | --- | ---
+1 | eth_dst=FF:FF...:FF | output FLOOD
+
+ARP prepopolata
+- h1 -> s1: MAC1, MAC3, IPv4, IP1, IP3, UDP, 1234, 53
+- s1 -> C: packet_in(...)
+- C -> s1:flow_mod (match(eth_src=MAC1, eth_dst=MAC3, eth_type=IPv4,
+                    ip_dst='10.0.0.3'), priority=1,
+                    actions (set_field(ip.dst='10.0.0.2'), output(2)))
+
+
+

+ 103 - 0
Piattaforme Software per la Rete/MOD1/lesson_18.md

@@ -0,0 +1,103 @@
+# Piattaforme e Software per la rete - lezione 18
+#### Giacomo Verticale
+###### 7 June 2016
+
+# Intrusion Detection Systems
+Un IDS é un *middlebox* che si occupa di rilevare la presenza di intrusioni o 
+si assicura del rispetto delle policy di sicurezza
+In particolare i __Network Intrusion Detection Systems__ effettuano *deep packet inspection*
+Cioé analizzano il payload dei pacchetti
+
+É difficile effettuare il match a livello applicativo perché spesso i
+protocolli sono di tipo testuale, come HTTP
+
+Un __Host Intrusion Detection System__ invece si occupano di monitorare gli ingressi 
+e le uscite di un singolo host.
+
+A differenza del matching sui campi del pacchetto, il *deep packet inspection* 
+ha un rischio concredo di *falsi positivi*, ad esempio cercando una
+stringa `HTTP` nel pacchetto, potremmo rilevare anche delle email contenenti dei link.
+
+In genere i sistemi di ricerca, piú estendono il campo della loro ricerca e sono aggressivi,
+e piú c'é il rischio che trovino dei falsi positivi. Per questo di solito
+Gli IDS si limitano a lanciare degli allarmi e lasciare ad un sistema di __management__ 
+lo svolgimento dell'azione.
+
+I sistemi di *deep packet inspection* sono utilizzati anche dai provider per capire che
+frazione del traffico é di natura VoIP, in modo da poter favoreggiare o ostacolare il traffico
+per favorire la telefonia tradizionale (discorso su net neutrality)
+
+Gli IDS si dividono in:
+- __Signature Detection__ hanno un database che permette di identificare particolari
+pacchetti tramite una signature, tuttavia possono identificare solo problemi noti (es. ransomware)
+- __Anomaly Detection__ definiscono una situazione standard e segnalano un allarme ogni volta che si 
+esce da una situazione normale, questi sistemi possono prevenire anche attacchi non documentati.
+
+Un __IDS__ é piú lento rispetto ad un __firewall__, perché invece che effettuare match in posizioni note,
+deve ricercare delle stringhe nel payload.
+Un firewall viene posizionato ai bordi della rete, per identificare problemi verso l'esterno,
+mentre gli IDS vengono posti all'interno della rete per monitorare il traffico all'interno.
+
+Cisco sta proponendo dei sistemi che integrano un firewall che agisce fino al livello applicativo,
+con un IDS che é in grado di riconoscere le signature dei pacchetti.
+
+Per costruire le signature sono necessari esempi di intrusioni per poter costruire un database.
+Usate per questo sono le *honeynets*: reti che hanno l'unico scopo di attirare attacchi
+per poterli catalogare, un principio simile é usato nei sistemi antispam, in cui viene creato
+un indirizzo email che non corrisponde a nessuna persona fisica, e tutte le mail che riceve
+sono per definizione spam.
+
+## Cercare nei pacchetti
+Di solito gli IDS effettuano ricerca di stringhe nel payload, ma possono utilizzare anche 
+delle *regular expression*, anche se il costo computazionale sale.
+
+Spesso il payload di una sessione TCP é diviso tra diversi pacchetti, quindi puó essere
+effettuata una operazione di *preprocessing* che consiste nel raccogliere tutti i payload
+di una stessa connessione TCP.
+
+Un attaccante puó dividere il payload di attacco in tanti pacchetti piú piccoli, per fare
+in modo che IDS che analizzano pacchetti singoli non riescano a rilevare l'attacco
+
+Un prodotto commerciale diffuso per DPI é __SNORT__ che é un software commerciale
+di cui l'engine é open source, il database degli attacchi é disponibile a pagamento
+per le versioni piú aggiornate e gratuitamente per le versioni piú vecchie.
+
+SNORT effettua un match con un set di regole BGP
+Una volta che viene effettuato un match, viene lanciato un allarme e il pacchetto 
+viene inviato ad un supervisore o ad un sistema di management centralizzato che gestisce piú IDS,
+oppure ad un supervisore che controllerá il pacchetto.
+
+I protocolli si dividono in __binari__ e __testuali__, nei protocolli OSI sono sempre
+stati usati protocolli binari, mentre i protocolli testuali sono stati scelti da IETF
+per facilitá di debug.
+Ultimamente c'é una tendenza a usare protocolli binari perché usano meno spazio
+e bastano programmi piú semplici per leggerli, ad esempio HTTP:2.0 é un protocollo binario.
+
+Questo vantaggio é anche dovuto alla diffusione di sistemi embedded e di sensori
+che non hanno la possibilitá di far girare grossi programmi.
+Inoltre la possibilitá di debugging testuale é impedita dall'uso di protocolli crittografati,
+quindi c'é un motivo in meno per usare protocolli testuali.
+
+Nel caso di protocolli cifrati di solito viene terminata la cifratura nel sistema di DPI e la connessione
+viene continuata il chiaro verso il destinatario o viene cifrata con una chiave diversa.
+
+## Azioni possibili
+- Alert
+- Log
+- Drop
+- Reject
+
+## Regole
+Nelle regole é possibile anche effettuare delle negazioni, questo comporta un costo computazionale piú alto
+col vantaggio di ottenere un ruleset piú compatto.
+
+La parte piú interessante di queste regole é l'analisi del payload, ad esempio il campo `content` permette di 
+cercare una stringa nel payload, tuttavia l'algoritmo per fare questo ha costo lineare con la lunghezza
+del payload, e al massimo é possibile confrontare piú match allo stesso momento con un costo
+lineare non grosso, (sublineare per il numero di stringhe da cercare usando i trie).
+
+Per evitare costo computazionale inutile, i pacchetti delle connessioni che sono state accettate non
+vengono piú analizzati.
+
+
+

+ 6 - 0
Piattaforme Software per la Rete/MOD2/genpdf.sh

@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+# Packages needed:
+# pandoc, texlive-core, texlive-latexextra 
+
+cat lesson_*.md | pandoc --latex-engine=xelatex -o course.pdf

+ 13 - 0
Piattaforme Software per la Rete/MOD2/lesson_00.md

@@ -0,0 +1,13 @@
+---
+fontsize: 12pt
+---  
+
+# Piattaforme Software per la Rete
+
+### Modulo 2
+    
+# William Fornaciari
+
+\pagebreak
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD2/lesson_01.md

@@ -109,3 +109,6 @@ Esiste una distinzione tra Ready to run in memory e Preempted
 
 ### Processo di boot
 Ultimamente in linux si sta tentando di caricare le cose non tutte insieme ma quelle essenziali prima in modo che il sistema risulti già usabile
+
+
+

+ 1 - 0
Piattaforme Software per la Rete/MOD2/lesson_02.md

@@ -109,3 +109,4 @@ Nel caso si riceva un segnale è possibile
 può essere combinata con un handler e pause per fare un timeout o altri barbatrucchi.
 
 
+

+ 3 - 0
Piattaforme Software per la Rete/MOD2/lesson_03.md

@@ -96,3 +96,6 @@ la *portabilità* del codice.
 __RIPASSARE__
 Il carico dei processi di solito avviene a *burst*, seguiti dall'attesa per l'I/O
 Lo scheduler *preemptive* è più difficile da gestire rispetto ad uno normale
+
+
+

+ 3 - 1
Piattaforme Software per la Rete/MOD2/lesson_04.md

@@ -1,4 +1,4 @@
-# Piattaforme e Software per la rete - lezione 2
+# Piattaforme e Software per la rete - lezione 4
 #### William Fornaciari
 ###### 30 March 2016
 ## Modulo 2
@@ -86,3 +86,5 @@ La API permette anche l'interoperabilità tra sistemi operativi diversi.
 
 Il protocollo più comune è quello *client/server*
 
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD2/lesson_05.md

@@ -64,3 +64,6 @@ leggono e scrivono sulla stessa pipe.
 Quindi mi serve chiudere uno dei due pipe nel padre e nel figlio con `close(p[0])` o `close(p[1])`
 Rispettivamente nel padre e nel figlio o viceversa, in modo da avere una comunicazione normale.
 Una chiusura non pulita di una pipe può portare a un errore `broken pipe`.
+
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD2/lesson_06.md

@@ -40,3 +40,6 @@ Una politica __FIFO__ per la gestione della coda di stampa è adeguata.
 __Distributed deadlock detection__
 Viene inviato un messaggio che contiene informazioni su risorsa attesa e chi la attende,
 se il messaggio torna al mittente con il proprio ID, allora è stato rilevato un ciclo.
+
+
+

+ 2 - 0
Piattaforme Software per la Rete/MOD2/lesson_07.md

@@ -89,3 +89,5 @@ il risultato su una memoria condivisa.
 Le __matrici crossbar__ hanno il problema che il numero di punti cresce esponenzialmente
 quindi spesso vengono sostituite da switch a strati.
 
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD2/lesson_08.md

@@ -56,3 +56,6 @@ Durante lo sviluppo di barbecue, è stato risolto il problema multiobiettivo
 del modello teorico di allocazione (simile a knapsack o tsp) ed è stata creata
 un'euristica per ottenere risultati simili al modello teorico.
 L'overhead del sistema è stato limitato al 10%
+
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD2/lesson_09.md

@@ -70,3 +70,6 @@ Puó capitare che una workstation vada in crisi e rimandi al mittente i processi
 Spesso conviene migrare i processi in gruppo, 
 ad esempio gruppi di processi che comunicano tra di loro possono essere schedulati per lo stesso time slot
 su macchine diverse, in modo che possano comunicare senza ritardi.
+
+
+

+ 3 - 0
Piattaforme Software per la Rete/MOD2/lesson_10.md

@@ -74,3 +74,6 @@ Di particolare nota é lo scheduler __Rate Monotonic__ che é in grado di garant
 in modo dimostrabile il rispetto delle deadlines e un buon utilizzo generale della CPU.
 
 Guardo slides su RTX
+
+
+

+ 10 - 0
Principles of Programming Languages/lesson_01.md

@@ -0,0 +1,10 @@
+# PLP - lesson 01
+##### Matteo Pradella
+## Introduction
+
+__web-page__:
+
+20 years ago compilers were usually bought.
+Thanks to the open source movement, now we have free compilers and environments for almost all programming languages.
+
+[www.scheme.com/tsp14]  

+ 135 - 0
Segnali/lesson_01.md

@@ -0,0 +1,135 @@
+# Segnali e Sistemi per le Telecomunicazioni
+#### Claudio Prati
+###### 6 March 2017
+#### Prima lezione
+
+## Introduzione
+Le lezioni seguono il libro di testo.
+
+Nel corso verranno spiegate delle tecniche per codificare e trasmettere
+informazioni nel campo delle telecomunicazioni.
+
+Studieremo delle tecniche deterministiche e razionali, ma non sono le uniche
+possibili, infatti esistono i meccanismi di reti neurali e machine learning che
+sono in grado di apprendere meccanismi complicati in modo semplice.
+
+Alcuni dei problemi si possono risolvere con tecniche classiche/razionali, usare
+gli algoritmi machine learning per risolvere questi problemi é overkill.
+
+Alcuni segnali possono essere modellizzati come funzione di una variabile.
+Mentre altri segnali non possono essere rappresentati come funzioni ma sono
+comunque offetto di studi, ad esempio una registrazione della voce.
+
+Altre tecniche interessanti sono quelle che permettono di ridurre il rumore di
+un segnale, ad esempio usate per pulire il segnale ricevuto dalle sonde nello
+spazio.
+
+### Dettagli sul corso
+Lunedí inizia alle 16:15
+Mercoledí si fanno 3 ore normalmente, iniziando alle 14:30,
+la quarta ora si fará in via eccezionale se servisse recuperare delle lezioni.
+Il venerdí si comincia alle 8:15
+
+Il __laboratorio__ consiste nell'applicare in matlab le cose spiegate in teoria,
+non é oggetto dell'esame ma interessante e utile per capire meglio i concetti.
+
+Il __libro di testo__ é scritto da Prati.
+
+__Esami__: no prove intermedie, 2 appelli per sessione con possibilitá di
+anticipare uno dei due appelli prima dell'inizio della sessione.
+Quindi é possibile fare due appelli su tre date.
+All'esame é possibile portare tutto il materiale che si vuole.
+
+Il __materiale didattico__ si puó trovare dalla pagina del personale DEIB di
+Prati, nella sessione *materiale didattico*, in cui sono presenti tutti i temi
+d´ esame dal 2007, i file di matlab e il formulario.
+
+__contatti:__ l'orario di ricevimento é il martedí... ma non viene seguito dal
+docente, peró se si manda un email al professore ci si puó mettere d'accordo.
+email:*claudio.prati@polimi.it*
+
+### Preconcetti
+Una __funzione__ é un valore intero, reale o complesso che varia in base ad un
+altro valore, detto variabile indipendente puó essere rappresentato in una 
+tabella o in un grafico.
+
+La variabile indipendente é spesso il tempo ma non é per forza cosí.
+Infatti esistono sistemi anticausali in cui l'uscita avviene prima
+dell'ingresso, e questi sistemi non possono essere spiegati usando il tempo come
+variabile.
+L'unico film che risolve il paradosso del tempo é Interstellar, e lo fa usando
+il concetto di universi paralleli, altre soluzioni ricadono in un paradosso
+circolare.
+
+Se consideriamo __lo spazio come variabile__ e non il tempo, abbiamo per un certo
+stimolo, degli effetti causali e degli effetti anticausali.
+
+Una prima funzione é 
+$$X(t) = cos(2\pit)$$
+La rappresentazione grafica é semplice
+
+Se trattiamo una funzione complessa é questa
+$$X(t)= cos(2pit) + jsin(2pit)$$
+Ha una parte reale e una parte immaginaria, qindi per rappresentarla
+graficamente devo usare due grafici, uno per la parte reale e uno per la parte
+immaginaria.
+Una seconda rappresentazione é quella polare in cui i due grafici sono modulo e
+angolo, l'angolo in teoria dei segnali viene chiamato *fase*.
+
+
+Il modulo del grafico polare é $|x(t)| = sqrt(cos^2(2pit)+sin^2(2pit))=1)$
+Mentre la fase é $fase x(t) = \arctg(\sin(2\pit)/\cos(2\pit))=2\pit$
+
+Matlab potrebbe dare una rappresentazione diversa del grafico della fase, a
+dente di sega, e questo é grazie al fatto che gli angoli si ripetono ogni $2\pi$
+
+L'ambiguitá di $2\pi$ permetterá di risolvere in modo esatto il problema del
+campionamento.
+
+Se prendiamo un __segnale discreto__, possiamo rappresentare un segnale
+continuo in in forma discreta, come una sequenza di numeri 
+$$X(nT)=\cos(2\pinT)$$.
+
+Il calcolatore per T=1/4 legge una formula $cos(2\pin/4)=X_n$
+La formula numerica dei campioni viene rappresentata col simbolo $X_n$ a
+differenza di quella grafica che viene rappresentata con $nT$
+
+L'elenco di segnali che affronteremo nel corso é:
+- Segnali continui reali e complessi
+- Segnali discreti
+
+Entrambe le tipologie di segnali possono essere:
+- periodici
+- aperiodici
+
+### Operazioni elementari sui segnali
+__Traslazione__:
+$$X(t-\tau)$$
+Il segnale originale $X(t)$ viene spostato verso sinistra (viene ritardato), in
+pratica stiamo modificando l'asse dei tempi, non il segnale.
+$X(t-\tau)$ ad esempio é un anticipo
+
+__Scalatura__:
+$$X(at)$$
+Se $a>1$ il tempo diventa piú veloce e il segnale *dimagrisce*
+Se $a<1$ ho dilatato il tempo e il segnale risulta *ingrassato*
+
+__Scalatura e traslazione__:
+$$X(at-\tau)$$
+Le due operazioni vanno effettuate in un ordine preciso, in base alla forma in
+cui é espresso il segnale, ad esempio:
+- __Prima la traslazione__
+- __Poi la scalatura__
+$$X(\xi)$$
+$$\xi = at - \tau$$
+$$t = (\xi+\tau)\a$$
+
+$$\Tilde{X}(t)=\Sum_{-\inf}^{+\inf}(X(t-nT_0))$$
+$$\Tilde{X}_n=\Sum_{-\inf}^{+\inf}i(X_{n-kN_o}))$$
+
+Energia di un segnale qualsiasi
+$$E_{x(t)}=\Int_{-\inf}^{+\inf}|X(t)|^2dt$$
+
+Potenza di un segnale periodico
+$$P_{x(t)}=\Lim_{T->\Inf} 1/T
+\Int_{-T/2}^{T/2}|X(t)^2dt=1/T_0\Int_{T_0}|X(t)|^2dL$$

+ 34 - 0
polimd_archived/operations_research/lesson_01.md

@@ -0,0 +1,34 @@
+# Operations Research
+#### Enrico Malucelli
+##### 6 October 2015
+## Introduction
+### What is Operations Research?
+Is a method of taking decisions using math
+
+Typically we solve optimization problems daily withoud being conscious
+
+        Confucius
+
+        I hear and forget,
+        I see and remember,
+        I do and understand.
+####Interesting sites:
+
+
+### What kind of decisions?
+- __Strategic__ Level: design a railroad
+- __Tactical__ level: how many trains to use
+- __Operational__ level: schedule the trains
+
+### How OR approaches the problems
+- __Decisions__
+- __Rules__ Mathematical constraints
+- __Objective__ Maximize the income
+#### Solution to phone building example:
+- plot the constraints in a 2D graph
+- select the region below all the constraints
+- Find the optimal solution analyzing the vertexes of the polygon.
+
+(In this case the vertex were integers but they may be real numbers and the solution is required to be integer.)
+### Challenges
+http://challenge.roadef.org/2016/en/index.php

+ 97 - 0
polimd_archived/operations_research/lesson_02.md

@@ -0,0 +1,97 @@
+# Operations Research
+#### Enrico Malucelli
+##### 6 October 2015
+## Introduction
+### Exercise: How to invest a budget
+
+###Steps
+#### 1. decisions
+#### 2. constraints
+
+####Solution
+#####Variables
+$x_i$= amount of money invested
+(i=1...5), $x_i \ge 0$
+#####constraints
+$\sum x_i \le 137$
+
+$x_1 \le 40$
+
+$x_2 \le 12$
+
+$x_3 \le 130$
+
+$x_4 \le 5$
+
+$x_5 \le 400$
+#####target
+$x_1/40*3.2+x_2/12*1.5+x_3/130*4.2+x_4/5*0.7+x_5/400*17$
+
+####Alternative solution
+$y_1$=share of bond
+$y_1=x_1/availability$
+$0 \le y_1\le1$
+$i=1$
+
+$$40y_1+12y_2+130y_3+5y_4+400y_5\le137$$
+$$max32y_1+15y_2+4.2y_3+0.7y_4+17y_5$$
+
+We can divide each bonus for the total of the earning so we can get an index of the best investment.
+$$8\%y_1+125\%y_2+3.2\%y_3+14\%y_4+4.25\%y_5$$
+
+We notice that the $y_2$ is the best investment, and we should buy as much as we can of that kind.
+
+example:
+$y_4=1$
+$y_2=1$
+$y_1=1$
+$y_5=...$
+####Algorithm generalization
+$$\sum c_i y_i$$
+$$\sum a_i y_i \le b$$
+$$0\le y_i \le 1 i=1 \mu$$
+Sort indicates by non decreasing $C_i/a_i$ cosider the variables in the Order:
+$$y_i=\begin{cases} 1,& if &b \ge a_i\\
+b/a_i,& if &b < a_i
+\end{cases}$$
+$$b-y_ia_i$$
+
+###Logical variables
+Can assume only the values $\{0,1\}$
+####example:
+A burglar sneaks into a jewelry and his bag can hold 8kg, what must he steal?
+
+|| object | 1 | 2 | 3 | 4 | 5 | 6 |
+|-------|--------|---|---|---|---|---|---|
+| value | $v_i$  | 7 | 2 | 4 | 5 | 4 | 1 |
+|weight|$w_i$|5|3|2|3|1|1|
+####solution
+Contrary to the previous problem (in which we had infinite solutions, like any fraction), in this problem we have at most $2^6$ solutions, maybe not all of them are feasible.
+
+x_i = 1 if the burglar has taken, 0 otherwise
+
+$$max \sum v_i x_i$$
+$$\sum w_i x_i \le b(=8)$$
+
+If we apply the same algorithm as before, we can calculate the value_for_weight factor of every object and choose the best ones.
+#####However this is not the best solution
+####Logical variable, __Complement__
+$$x'_i=1-x_i$$
+####Other types of variables
+####Integer Variables
+####Discrete value variables
+In most cases we select the value of a variable within a __finite set__
+e.g.: the memory size of a computer, the capacity of a telecommunication link.
+$$x\in \{ v_1,v_2,...,v_r\}$$
+#####formulas
+$$s_i=\begin{cases}
+1,& x=v_i\\
+0,& \end{cases}$$
+###example: diet
+|food|pasta|rice|steak|carrots|potatoes|pear|
+|----|-----|----|-----|-------|--------|----|
+|calories per hg|300|250|200|70|180|100
+####Minimum required calories: __700__
+We can transform all the inequalities to be less or equal
+
+And later we need to transform our inequalities into equalities

+ 0 - 0
polimd_archived/operations_research/note_follows_on_paper


+ 95 - 0
polimd_archived/soft_computing/lesson_01.md

@@ -0,0 +1,95 @@
+# Soft Computing
+#### Andrea Bonarini
+##### 5 October 2015
+
+#### What is Soft Computing?
+
+The term was introduced by Lotfi Zadeh, the father of fuzzy sets,
+to denote programming techniques not related to *traditional* programming languages:
+- Fuzzy systems
+- Neural networks
+- Stochastic systems
+
+##### definition
+A set of techniques to model systems (input-output mapping) by approximating them.
+
+##### Modelling technique: generalization
+Considers a small sample of the entity to make an approximate model,
+
+
+#### Model
+
+- Is a *representation* of some entity, defined for a *specific purpose*.
+
+- Is limited to aspects of the entity represented which are *relevant for the purpose*
+
+- A model is different to the represented entity ex: map vs land
+
+- Models lead to *approximation, uncertainty, imprecision*.
+
+##### Approximation
+The model features are similar to the real ones but not the same.
+##### Uncertainty
+We are not sure that the features of the model are the same of the entity.
+##### Imprecision
+The model features values are not precise.
+
+#### Techniques
+
+- ##### Fuzzy sets:
+    Correct model in a finite number of points, smooth transistion (approximation) among them.
+
+    ex: in a thermal control system we fix the normal working point and the critical one, and the system approximates the behaviour between.
+
+- ##### Neural networks
+    input-output samples, learning algorithms to define output values for unknown values.
+
+- ##### Genetic algorithms
+    Optimal solution, obtained by evaluating populations of tentative solutions and combining their parts (sort of copying from nature).
+
+#### Applications:
+
+From washing machines to helicopters, to rice cookers
+
+### Fuzzy Sets
+
+Were created in 1965 by Lotfi Zadeh
+
+The principle is to make computation with words.
+
+#### What is a fuzzy set?
+Is a set whose membership function can range on the interval [0,1].
+
+On contrary to __crisp sets__ that admit only {0,1}
+
+###### A membership function defines a set
+###### Defines the degree of membership of an element to the set
+μ: U -> [0,1]
+
+#### How to define membership functions
+- select a variable
+    - distance
+- define a range of the variable
+    - [0..10]
+- identify labels
+    - close, medium, far
+- for each label identify the charachteristic points
+    - 0, max, middle values, where MF=1, ...
+- identify function shapes
+    - linear
+- check
+
+#####Membership functions can also overlap,
+and this quality is useful for example in classification of a noisy input,
+in fact with overlapping MF we have a *smooth transition* from a label to another
+
+#### MF and concepts
+
+__MFs__ define __fuzzy sets__
+
+__Labels__ denote __fuzzy sets__
+
+__Fuzzy sets__ can be considered as conceptual representations
+
+#### Symbol grounding
+Reason in terms of concepts and grounds them to reality.

+ 34 - 0
polimd_archived/soft_computing/lesson_02.md

@@ -0,0 +1,34 @@
+# Soft Computing
+#### Andrea Bonarini
+##### 8 October 2015
+
+#### Membership Function and concepts
+
+#### Propertise of a frame of cognition
+each fuzzy set is called a __granule__
+- __Coverage__:each value belong at least to a value
+
+### Robustness
+
+### $\alpha$-cuts
+
+### Support of a fuzzy set
+
+### Height of a fuzzy set
+
+### Strange MF
+
+####Singleton
+A fuzzy set with one member
+
+### Standard operators of fuzzy sets
+
+__Complement__
+
+$\mu_f(x)=1-\mu_f(x)$
+
+__Union__
+
+The maximum of two fuzzy sets
+
+__Intersection__

+ 0 - 0
polimd_archived/soft_computing/note_follows_on_paper