course 4 13 march 2019 [email protected]/scoala/2019/pe/courses/pe04.pdf · sequence...

65
Course 4 – 13 March 2019 [email protected] 1

Upload: others

Post on 25-Jun-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Course 4 – 13 March 2019

[email protected]

1

Page 2: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

From previous courses…

UML Diagrams:◦ Interactions (Sequence, Collaboration)

◦ Behaviour (States, Activities)

◦ Structure (Deployment)

C4 Model

Forward & Reverse Engineering

2

Page 3: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Diagrams

UML Diagrams

Use Case Diagrams

Class Diagrams

3

Page 4: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

4

Page 5: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

5

Page 6: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

6

Page 7: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Sequence Diagram contents the sequence of actions which occur in the system, each object invocation methods, as well as the order in timein which these invocations take place

A sequence diagram is bi-dimensional◦ On the vertical axis it shows the life of the object

The lifeline of the objects (graphic: dotted line)

The activation period in which an object takes control of execution (graphic rectangle on the lifeline)

◦ The horizontal axis shows the sequence of creation orthe invocations

messages ordered in time (graphic: darts)

7

Page 8: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

8

Page 9: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

9

Page 10: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Emphasizes the structural organization of the objects participating in the interaction

It illustrates better complex ramifications, iterations and concurrent behavior

May contain:◦ Objects, classes, actors

◦ Links between them

◦ Messaging

10

Page 11: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

11

Page 12: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

12

Page 13: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

State Diagrams, Activity Diagrams

Basic elements

◦ Event

◦ Action

◦ Activity

13

Page 14: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Contain:◦ States

◦ Transitions

14

Page 15: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Composite state with under state sequentially active:

15

Page 16: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Composite state with under state parallel active:

16

Page 17: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Used to model the dynamics of a process or operation

Highlights execution control from one activity to another

It is attached to:◦ A class (models an use case)

◦ A package

◦ Implementation of operations

17

Page 18: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

18

Page 19: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

19

Page 20: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Model the hardware environment where the project will work

Example: to describe a web site a deployment diagram will contain hardware components for◦ web server,

◦ server applications,

◦ server database

Software components on each of these◦ The web application

◦ Database

◦ The way in which they are connected: JDBC, REST, RMI

20

Page 21: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

21

Page 22: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Package:◦ It is a logical container for elements between which we

have connections

◦ Defines a namespace

◦ All UML elements can be grouped into packages (most packages are used to group classes)

◦ A package may contain subpackages => creates a tree structure (similar to organizing files / folders)

22

Page 23: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Relations:◦ dependence <<access>> = privat import

◦ dependence <<import>> = public import

Both relationships allow use of elements found in the destination package by the evidence in the source package without the need of qualifying the names of items in the package destination (similar to import directive in java)

These types of diagrams are provided in class diagrams

23

Page 24: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Elements from Types are imported in ShoppingCart and then areimported by WebShop

Elements from Auxiliary can be accessed only from ShoppingCart and cannot be referred from WebShop

24

Page 25: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Divide large systems into smaller and more manageable subsystems

Allowing iterative parallel development

Defining clear interfaces between packages forcode reuse (eg. Packages for graphic interface,for enabling connection to BD, etc ...)

25

Page 26: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Diagrams are neither too complicated nor too simple: the goal is effective communication

Give suggestive names for components

Elements arranged so that the lines do not intersect

Try not to show too many kinds of relationships once (avoid complicated diagrams)

If necessary, make more diagrams of the same type

26

Page 27: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Context, Containers, Components and Code

Provides different levels of abstraction, each of

which is relevant to a different audience

Avoid ambiguity in your diagrams by including a

sufficient amount of text as well as a key/legend

for the notation you use

27

Page 28: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Shows the software system you are building

How it fits into the world in terms of the people who use it and the other software systems it interacts with

Colours - Systems already exist (the greyboxes) and those to be built (blue)

28

Page 29: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Zooms into the software system, and shows the containers (applications, data stores, microservices, etc.)

29

Page 30: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Zooms into an individual container to show the components inside it

30

Page 31: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Zoom into an individual component to show how that component is implemented

31

Page 32: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

https://tobiashochguertel.github.io/c4-draw.io/

https://structurizr.com/express

https://www.infoq.com/articles/C4-architecture-model

https://c4model.com/

32

Page 33: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

33

Page 34: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

A traditional process of moving from high-level abstractions and logical to the implementation-independent designs to the physical implementation of a system

FE follows a sequence of going from requirements through designing its implementation

34

Page 35: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Reverse engineering (RE) is the process of discovering the technological principles of a device, object or system through analysis of its structure, function and operation

To try to make a new device or program that does the same thing without copying anything from the original

Reverse engineering has its origins in the analysis of hardware for commercial or military advantage

35

Page 36: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Interoperability

Lost documentation

Product analysis

Security auditing

Removal of copy protection, circumvention of access restrictions

Creation of unlicensed/unapproved duplicates

Academic/learning purposes

Curiosity

Competitive technical intelligence (understand what your competitor is actually doing versus what they say they are doing)

Learning: Learn from others mistakes36

Page 37: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

RE1: Reverse engineering of mechanical devices

RE2: Reverse engineering of integrated

circuits/smart cards

RE3: Reverse engineering for military

applications

RE4: Reverse engineering of software

37

Page 38: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

38

Page 39: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

39

Page 40: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Rapid prototyping

FullCure materials

40

Page 41: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

41

Page 42: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

42

Page 43: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

RE is an invasive and destructive form of analyzing a smart card

The attacker grinds away layer by layer of the smart card and takes pictures with an electron microscope

Engineers employ sensors to detect and prevent this attack

43

Page 44: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

44

Page 45: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

45

Page 46: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Satellite TV

Security card

Phone card

Ticket card

Bank card

46

Page 47: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Reverse engineering is often used by militaries in order to copy other nations' technologies, devices or information that have been obtained by regular troops in the fields or by intelligence operations

It was often used during the Second World War and the Cold War

Well-known examples from WWII and later include: rocket, missile, bombers, China has reversed many examples of US and Russian hardware, from fighter aircraft to missiles and HMMWV cars

47

Page 48: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

US – B-29 URSS – Tupolev Tu-4

48

Page 49: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Chinese J-20, Black Eagle US F-22, Russian Sukhoi T-50

49

Page 50: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

US -AIM-9 Sidewinder Soviet - Vympel K-13

50

Page 51: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

51

Page 52: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

52

Page 53: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Reverse engineering is the process of analyzing a subject system to create representations of the system at a higher level of abstraction

In practice, two main types of RE emerge: ◦ Source code is available (but it is poorly documented)

◦ There is no source code available for the software

Black box testing in software engineering has a lot in common with reverse engineering

53

Page 54: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

54

Page 55: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

55

Page 56: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

public class Test

{

private int n;

private int m;

public static void main(String args[])

{

for(int i=1;i<10;i++)

System.out.println("Test");

}

}

56

Page 57: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Link: http://www.steike.com/code/java-reverse-engineering/

jad.exe FileName.class => FileName.jad

57

Page 58: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

58

Page 59: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

59

Page 60: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

File -> Import Sources...

60

Page 61: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

61

Page 62: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Forward engineering:◦ Class diagrams -> .java files (ArgoUML)

◦ .java files -> .class files (NetBeans)

Reverse engineering: ◦ .class files -> .java files (JAD Decompiler)

◦ .java files -> Class Diagrams (ArgoUML)

62

Page 63: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

UML Diagrams:◦ Interactions

◦ Behavior

◦ Structure

C4 Model: context, container, component,

code

63

Page 64: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

Ovidiu Gheorghieş, Course 5 IP

www.uml.org

Reverse Engineering and Design Discovery: A Taxonomy, Chikofsky, E.J. and Cross, J., January, 1990

64

Page 65: Course 4 13 March 2019 adiftene@info.uaicadiftene/Scoala/2019/PE/Courses/PE04.pdf · Sequence Diagram contents the sequence of actions which occur in the system, each object invocation

DJ Java Decompiler 3.10.10.93: http://www.softpedia.com/progDownload/DJ-Java-Decompiler-Download-13481.html

Open Office: http://ro.wikipedia.org/wiki/OpenOffice.org UML Reverse Engineering for Existing Java, C# , and Visual Basic .NET Code:

http://www.altova.com/umodel/uml-reverse-engineering.html Reverse Engineering:

http://en.wikipedia.org/wiki/Reverse_engineering PROTO 3000 3D Engineering Solutions:

http://www.proto3000.com/services.aspx HAR2009: http://www.degate.org/HAR2009/ Degate: http://www.degate.org/screenshots/ Inteligent: http://www.intelligentrd.com/ Smartphones RE: http://www.cytraxsolutions.com/2011/

01/smartphones-security-and-reverse.html

65