403Webshell
Server IP : 217.160.0.143  /  Your IP : 216.73.216.50
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : u89353126 ( 3190106)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/share/doc/libipc-shareable-perl/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/libipc-shareable-perl/examples/hvtest2
#!/usr/bin/perl -w
#
# Test of shared hashes courtesy Robert Emmery <roberte@netscape.com>
use IPC::Shareable;
use Data::Dumper;

use strict;

  my %shareOpts = (
                create =>       'yes',
                exclusive =>    'no',
                mode =>         0644,
                destroy =>      'yes',
                );

  my %childShareOpts = (
                create =>       'no',
                exclusive =>    'no',
                mode =>         0644,
                destroy =>      'yes'
                );

$SIG{'INT'} = sub { die; };

# create shared memory segment

my %hashTable = ();


print "\n\nPress any key to start.. (Press Ctrl+C to exit)\n\n";
<STDIN>;

tie(%hashTable, 'IPC::Shareable', "glue",  {%shareOpts }) || die "Failed to share hashTable"; 


if (fork() == 0) {
  # we're in process 1 
  # tie to hashTable...
  tie(%hashTable, 'IPC::Shareable', "glue",  {%childShareOpts} ) || die "Failed to tie from process 1";
  my $count = 0;
  while (1) {
    (tied %hashTable)->shlock();
      $hashTable{$count++ . " - proc 1"} = "proc 1"; 
      print "proc 1: " . Dumper(\%hashTable); 
    (tied %hashTable)->shunlock(); 
    sleep(2);
  }
}
if (fork() == 0) {
  # we're in proces 2
  # tie to hashTable...
  tie(%hashTable, 'IPC::Shareable', "glue",  {%childShareOpts} ) || die "Failed to tie from process 2";
  my $count = 0;
  while (1) {
    (tied %hashTable)->shlock();
      $hashTable{$count++ . " - proc 2"} = "proc 2";
      print "proc 2: " . Dumper(\%hashTable);
    (tied %hashTable)->shunlock();
    sleep(2);
  }
}


# do not exit as shared memory will get lost
while (1) {
  sleep(9999);
}

Youez - 2016 - github.com/yon3zu
LinuXploit