Posted By

illuzian on 12/04/10


Tagged

windows send Net netsend


Versions (?)

net_send.pl


 / Published in: Perl
 

For PC without the messenger service enabled that want to send net send messages to those that do...

  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. use Tk;
  5. use Net::NetSend qw(:all);
  6. use Socket;
  7.  
  8. my $target_ip;
  9. my $host;
  10. my $message;
  11. my $name;
  12. my $mw = MainWindow->new;
  13. $mw->Label(-text=> 'Message:')->pack();
  14. $mw->Entry(-textvariable=>\$message) -> pack();
  15. $mw->Label(-text=> 'Store ie n2010:')->pack();
  16. $mw->Entry(-textvariable=>\$host) -> pack();
  17. $mw->Button(-text => "Send", -command=>sub{sendm($message, $host)})->pack();
  18.  
  19. my $target_netbios_name;
  20. my $source_netbios_name = "ITCallcentre";
  21. my $debug = 1;
  22. sub sendm {
  23. print $message;
  24. print $host;
  25. ($message,$name) = (@_);
  26. $target_ip =inet_ntoa(inet_aton($name));
  27. print "$target_ip";
  28. $target_netbios_name = getNbName($target_ip, $debug);
  29. if(!$target_netbios_name){
  30. die "No netbios name found: $@\n";
  31. }
  32.  
  33. my $success = sendMsg($target_netbios_name, $source_netbios_name, $target_ip, $message, $debug);
  34. print ($success ? "Delivery successfull\n" : "Error in delivery! \n$@\n");
  35.  
  36. }
  37. MainLoop;

Report this snippet  

You need to login to post a comment.