Robert Gallo anaelezwa kwamba alihusika na vita vya kibaiolojia kwa lengo la kuwaondosha watu weusi na mashoga duniani katika miaka ya 1970..
Huu ndio Muonekano wa Kirusi cha Ukimwi..
<code class=" language-bash">curl -L https://install.pivpn.io <span class="token operator">|</span> <span class="token function">bash</span></code>Important Note: This command parses a random script downloaded from the web directly into your Pi’s bash. That can be incredibly dangerous if you don’t trust the installation source, as it will run whatever code you give it straight away. I haven’t gone through and vetted their bash command line by line (I trust them!) but it is available to look through on their GitHub account (under
install.sh within the auto_installfolder) if you have any concerns.<No> and hit Spacebar to select it. I then hit Enter to go to the setup to change my Pi’s static IP.192.168.0.31. Once you’ve got the IP address you’d like, hit Enter.192.168.0.1.
If you aren’t sure, try entering whatever IP address you enter to get to
your router’s config page in your browser. Once you’ve got this entered
in, hit the Enter key.<code class=" language-bash"><span class="token function">sudo</span> <span class="token function">apt-get</span> upgrade</code>Once that is all updated, we can feel safe enough to set up a client for VPN access!
<code class=" language-bash">pivpn add</code>It will ask you for a name for the client. Call it whatever your heart desires. It will also ask for a passphrase: this is the password for accessing the VPN through this client. Don’t forget this one — as you otherwise won’t be able to connect to your VPN server using this client!
.ovpn file for that client. You’ll need this to log in on each client device.
Local system ----> sends tcp syn packet -----> Remote system Local system <---- replies with a syn+ack packet <----- Remote system Local system ----> sends ack packet -----> Remote system
There are different scenarios of the port scanning called the “tcp syn port scanning” which established full 3 way hand shake./* Port scanner code in c */ #include "stdio.h" #include "sys/socket.h" #include "errno.h" #include "netdb.h" #include "string.h" #include "stdlib.h" #define MAX_INT 32767 int main(int argc , char **argv) { struct hostent *host; int err, i , sock ,start , end; char hostname[MAX_INT]; struct sockaddr_in sa; char port //Get the hostname to scan printf("Enter hostname or IP : "); gets(hostname); //Get start port number printf("\nEnter start port number : "); //To Handle the Input int data; data = scanf("%d",&start); if(start == EOF){ printf("Invalid Port Number"); exit(); } //Get end port number printf("Enter end port number : "); int data2 = scanf("%d" , &end); if(data2 == EOF){ printf("Invaid Port Number"); exit(); } //Initialise the sockaddr_in structure strncpy((char*)&sa , "" , sizeof sa); sa.sin_family = AF_INET; //direct ip address, use it if(isdigit(hostname[0])) { printf("Doing inet_addr..."); sa.sin_addr.s_addr = inet_addr(hostname); printf("Done\n"); } //Resolve hostname to ip address else if( (host = gethostbyname(hostname)) != 0) { printf("Doing gethostbyname..."); strncpy((char*)&sa.sin_addr , (char*)host->h_addr , sizeof sa.sin_addr); printf("Done\n"); } else { herror(hostname); exit(2); } //Start the port scan loop printf("Starting the portscan loop : \n"); for( i = start ; i <= end ; i++) { //Fill in the port number sa.sin_port = htons(i); //Create a socket of type internet sock = socket(AF_INET , SOCK_STREAM , 0); //Check whether socket created fine or not if(sock < 0) { perror("\nSocket"); exit(1); } //Connect using that socket and sockaddr structure err = connect(sock , (struct sockaddr*)&sa , sizeof sa); //not connected if( err < 0 ) { //printf("%s %-5d %s\r" , hostname , i, strerror(errno)); fflush(stdout); } //connected else { printf("%-5d open\n", i); } close(sock); } printf("\r"); fflush(stdout); return(0); }Run the program
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
class MyThread implements Runnable
{
Thread t;
boolean suspendFlag;
MyThread(String name)
{
t = new Thread(this, name);
System.out.println(“Child thread: “ + t);
suspendFlag = false;
t.start();
}
@Override
public void run()
{
try
{
for(int i = 1; i <= 5; i++)
{
System.out.println(t.getName() + “: “ + i);
Thread.sleep(500);
synchronized(this)
{
while(suspendFlag)
wait();
}
}
}
catch(InterruptedException e)
{
System.out.println(t.getName() + ” is interrupted!”);
}
System.out.println(t.getName() + ” is terminated”);
}
public synchronized void mySuspend()
{
suspendFlag = true;
}
public synchronized void myResume()
{
suspendFlag = false;
notify();
}
}
public class Driver
{
public static void main(String[] args)
{
MyThread thread1 = new MyThread(“First Thread”);
MyThread thread2 = new MyThread(“Second Thread”);
try
{
System.out.println(“Main thread is waiting…”);
Thread.sleep(1000);
thread1.mySuspend();
System.out.println(“—Suspending thread 1—“);
Thread.sleep(1000);
thread1.myResume();
System.out.println(“—Resuming thread 1—“);
Thread.sleep(1000);
thread1.t.join();
thread2.t.join();
}
catch(InterruptedException e)
{
System.out.println(“Main thread is interrupted!”);
}
System.out.println(“Main thread terminated”);
}
}
|
Child thread: Thread[First Thread,5,main]In the above output you can observer that first thread is suspended for some time and has been resumed again.
Child thread: Thread[Second Thread,5,main]
Main thread is waiting…
First Thread: 1
Second Thread: 1
First Thread: 2
Second Thread: 2
—Suspending thread 1—
First Thread: 3
Second Thread: 3
Second Thread: 4
—Resuming thread 1—
First Thread: 4
Second Thread: 5
First Thread: 5
Second Thread is terminated
First Thread is terminated
Main thread terminated
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
class MyThread implements Runnable
{
Thread t;
private volatile boolean stopFlag = false;
MyThread()
{
t = new Thread(this);
t.start();
}
public void run()
{
while(!stopFlag)
{
System.out.println(“Child thread running!”);
try
{
Thread.sleep(200);
}
catch(InterruptedException e) {}
}
System.out.print(“Child thread stopped!”);
}
public void stop()
{
stopFlag = true;
}
}
public class Driver
{
public static void main(String[] args) throws InterruptedException
{
MyThread m = new MyThread();
Thread.sleep(1000);
m.stop();
}
}
|
"Child thread running!
Child thread running!
Child thread running!
Child thread running!
Child thread running!
Child thread stopped!
|
1
2
3
4
5
6
|
table
{
border-style: solid;
border-width: 3px;
border-color: grey;
}
|
<span class="nv">$foo</span> <span class="o">=</span> <span class="nx">bars</span><span class="p">()</span>
<span class="nv">$foobars</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="nv">$foo</span><span class="p">,</span> <span class="nv">$bar</span><span class="p">);</span>
<span class="nv">$foobars</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$foo</span><span class="p">;</span>
<span class="nv">$foobars</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$bars</span><span class="p">;</span>
<span class="nv">$foobar</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s1">'foo'</span> <span class="o">=></span> <span class="nv">$foo</span><span class="p">,</span> <span class="s1">'bars'</span> <span class="o">=></span> <span class="nv">$bars</span><span class="p">);</span>
<span class="nv">$foobar</span><span class="p">[</span><span class="s1">'foo'</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$foo</span><span class="p">;</span>
<span class="nv">$foobar</span><span class="p">[</span><span class="s1">'bars'</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$bars</span><span class="p">;</span>
<span class="nv">$foobar</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$foos</span><span class="p">;</span>
<span class="nv">$foobar</span><span class="p">[</span><span class="s1">'foo'</span><span class="p">]</span> <span class="o">=</span> <span class="nv">$foos</span><span class="p">;
</span>
<span class="cp"><?php</span>
<span class="nv">$array</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s2">"name"</span><span class="o">=></span><span class="s2">"Toyotas"</span><span class="p">,</span><span class="s2">"type"</span><span class="o">=></span><span class="s2">"Celicas"</span><span class="p">,</span><span class="s2">"colour"</span><span class="o">=></span><span class="s2">"blacks"</span><span class="p">,</span><span class="s2">"manufactured"</span><span class="o">=></span><span class="s2">"1991"</span><span class="p">);</span>
<span class="nv">$array2</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s2">"Toyotas"</span><span class="p">,</span><span class="s2">"Celicas"</span><span class="p">,</span><span class="s2">"blacks"</span><span class="p">,</span><span class="s2">"1991"</span><span class="p">);</span>
<span class="nv">$array3</span> <span class="o">=</span> <span class="k">array</span><span class="p">(</span><span class="s2">"name"</span><span class="o">=></span><span class="s2">"Toyotas"</span><span class="p">,</span><span class="s2">"Celicas"</span><span class="p">,</span><span class="s2">"colours"</span><span class="o">=></span><span class="s2">"black"</span><span class="p">,</span><span class="s2">"1991"</span><span class="p">);</span>
<span class="nb">print_r</span><span class="p">(</span><span class="nv">$array</span><span class="p">);</span>
<span class="nb">print_r</span><span class="p">(</span><span class="nv">$array2</span><span class="p">);</span>
<span class="nb">print_r</span><span class="p">(</span><span class="nv">$array3</span><span class="p">);</span>
<span class="cp">?></span>
<span class="p"> </span>
|
1
2 3 4 5 6 7 8 9 10 11 12 13 |
<?php
$string_to_explode = ‘this-strings-needs-some-exploding’; //Break string into an arrays $exploded_strings = explode(‘-‘, $string_to_explode); print_r($exploded_strings); //output : // Array ( [0] => this [1] => string [2] => needs [3] => some [4] => exploding ) echo $exploded_strings[0]; echo $exploded_strings[1]; ?> |
|
1
2 3 4 5 6 7 8 |
<?php
//array values $array_values = array(‘eat’,‘sleep’,‘walk’,‘read’,‘write’,‘watch’,‘move’); //join all array values with “-” hyphen //output : eat-sleep-walk-read-write-watch-move echo implode(‘-‘, $array_values); ?> |
Copyright © All Rights Reserved / Distributed By Protemplateslab / Blogger Templates / Designed By: Edward Mangu