Skip to main content

Posts

Showing posts with the label tutorial

Tcl and OTcl Tutorial For NS2 variables and arrays

Tcl and OTcl Tutorial For NS2 variables and arrays Variables and arrays Defining a variable in Tcl is very simple: set var1 1 set var2 "Tcl Variable 2" The variables can be referenced by prefixing the variable name with a $. For example to print the above variables, we can use puts "var1=$var1, var2=$var2" Any situation in which you require that the value of the variable be used is one in which the $ prefix should be added to the variable name. In some situations, it is necessary to use the variable name directly. For example incr var1 can be used to increment var1. I guess you can think of it as the difference between call-by-reference and call-by-value: in the former case you use the variable name on its own, while in the latter you prefix it with a $. An alternative is to assign the results of a function to a variable. This can be done as follows: set var3 [expr 5*10] This sets the variable var3 to the result of calling the  expr  function with the parameter  5*1...

Tcl and OTcl Tutorial for NS2 Program to find Factorial

Tcl and OTcl Tutorial for NS2 Program to find Factorial  Fractorial Computation:  tcl script to obtain the value of 10! = 10 * 9 * ... * 1. get factorial.tcl and run the script; write a function to compute 2^x, test your answer. Execute the script as: $ tclsh lab1a.tcl or $ ns lab1a.tcl ################################################################################ #filename : factorial.tcl # define function to compute Factorial X! proc Factorial {x} {     # define variable     set result 1         # for loop     for {set i 1} {$i <= $x} {incr i} { set result [expr $result * $i]     }         # return computation result     return $result } ############################################################################# # define function to compute 2^x proc 2pow {x} {     # define variable     set result 1         # for loop   ...

Tcl and OTcl Tutorial For NS2 Loops and Conditional Statements

Tcl and OTcl Tutorial For NS2 Loops and Conditional Statements For loops For loops are very useful in ns and can be used in conjunction with arrays to easily create larger network topologies. To generate 100 nodes, the following code can be used: for {set i 0}{$i < 100}{incr i} {     set n($i) [$ns node] } While loops These are very similar to for loops. The syntax is set i 0 while {$i < 10} {     set n($i) [new Node]     incr i } If statements If statements are very simple if {$i < 10} {     puts "i is less than 10" } if {$var2 == "Tcl Variable 2"} {     puts "var2 = Tcl Variable 2" } download  file  now

Tabnabbing Tutorial

Tabnabbing Tutorial Tabnabbing is a computer exploit and phishing attack, which persuades users to submit their login details and passwords to popular websites by impersonating those sites and convincing the user that the site is genuine.The attack takes advantage of user trust and inattention to detail in regard to tabs, and the ability of modern web pages to rewrite tabs and their contents a long time after the page is loaded. Tabnabbing operates in reverse of most phishing attacks in that it doesn�t ask users to click on an obfuscated link but instead loads a fake page in one of the open tabs in your browser We cover two methods of tabnabbing. (1)Manual. (2)With the help of S.E.T. Tab-nabbing with help of S.E.T? (1)Open S.E.T.(you can find how to install & configure set here?) (2)Select option 1 which is Social-Engineering Attacks. (3)Select option 2 which is Website Attack Vectors. (4)Now option-4 which is tabnabbing attack method (5)Select site cloner. (6)Enter URL OF site. (F...

Tcl and OTcl Tutorial For NS2 Procedures

Tcl and OTcl Tutorial For NS2 Procedures Procedures Procedures are an essential component of Tcl and can be used to make programming ns simpler. As in any functional programming language, procedures can be used for repetitive tasks, or simply to logically break down the tasks in the program. Procedures are defined in Tcl as follows: proc proc1 {} {     puts "in procedure proc1" } This defines a procedure that takes no parameters and prints out "in procedure proc1". To call this procedure proc1 can be used. A procedure with parameters can be defined as follows: proc proc2 {parameter1} {     puts "the value of parameter1 is $parameter1" } This procedure can be invoked as follows: proc2 10 A procedure that returns a value can be defined as follows: proc proc3 {min max} {     set randomvar [rand $min $max]     return $randomvar } This procedure generates a random variable and returns it to the calling function. This can be invoked ...