403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.46
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/doc/perl-Convert-ASN1/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/perl-Convert-ASN1/examples/ldap-search
# This is an example of a search PDU from the LDAP protocol

use Convert::ASN1;
use Data::Dumper;

my %scope = qw(base  0 one    1 single 1 sub    2 subtree 2);
my %deref = qw(never 0 search 1 find   2 always 3);

my $search_pdu = Convert::ASN1->new;
$search_pdu->prepare(q(
  SEQUENCE {
    mesgid INTEGER,
    [APPLICATION 3] SEQUENCE {
      base      STRING,
      scope     ENUM,
      deref     ENUM,
      sizeLimit INTEGER,
      timeLimit INTEGER,
      typesOnly BOOLEAN,
      filter    STRING, -- for test, should be ANY and the var should hold
			-- a pre-encoded filter
      attrs SEQUENCE OF STRING
    }
    control [0] SEQUENCE OF SEQUENCE { -- this should be optional but we cannot do that inline
      type     STRING,
      critical BOOLEAN,
      value    STRING OPTIONAL
    }
  }
)) or die $search_pdu->error;

$buf = $search_pdu->encode(
  mesgid => 3,
  base   => "cn=base",
  scope  => $scope{one},
  deref  => $deref{find},
  sizeLimit => 0,
  timeLimit => 0,
  typesOnly => 0,
  filter    => "A filter",
  attrs     => [qw(cn postalAddress)],
  control   => [
    {
      type => "1.2.3.4",
      critical => 1
    },
    {
      type => "9.8.7.6",
      critical => 0,
      value => "abc"
    }
  ]
);

$Data::Dumper::Indent = 1;
print Dumper( $search_pdu->decode($buf));

$h = unpack("H*",$buf);
$h =~ s/(..)/$1 /g;
$h =~ s/(.{47}\s)/$1\n/g;
print $h,"\n";

Youez - 2016 - github.com/yon3zu
LinuXploit