Article 5692S Remove "weird" text in cgi after running command.

Remove "weird" text in cgi after running command.

by
voncloft
from LinuxQuestions.org on (#5692S)
I wrote a cgi script and it is working - however is there a way to get rid of some weird text during the run?

the code:
Code:#!/usr/bin/perl -w
use strict;
use warnings;
use 5.010;

use Data::Dumper;
use CGI;
my $q = CGI->new;

my %data;
$data{url} = $q->param('url');
$data{ip} = $q->param('ip');

print $q->header;

print "URL: $data{url} <br>";
print "IP: $data{ip}";
my $filename = '/srv/www/ip/text/hosts-file';
open my $fh, ">>", "$filename" or die "nope" ;
print $fh "$data{ip} $data{url} \n";

my $filename = '/srv/www/ip/text/hosts-ip';
open my $fh, ">>", "$filename" or die "nope" ;
print $fh "$data{ip} 0; \n";

system('sudo /etc/init.d/dhcpd restart');
system('sudo /etc/init.d/psad restart');
system('sudo /etc/init.d/hostapd restart');After it runs it has the following output:
Code:URL: woot
IP: 192.168.1.2 Stopping dnsmasq [0G[1;32m * [0;39m[-8G[1;34m[[1;32m OK [1;34m][0;39m Starting dnsmasq [0G[1;32m * [0;39m[-8G[1;34m[[1;32m OK [1;34m][0;39mI'd like it to be:
Code:URL: woot
IP: 192.168.1.2
Stopping dnsmasq OK
Starting dnsmasq OKIs this possible? webmin seems to have nailed this down, but frankly I am brand new to CGI - first day, and yes I know running root is a risk to my system....(I don't want to hear the ethics behind it, its my system, all this is behind a closed port only available to my lan - the outside world can't get in)

Me and google are having a translation problem, I could really use some human help on the final piece of the puzzle.

Thanks in advancelatest?d=yIl2AUoC8zA latest?i=R0u6qYMKsI4:gWPh6_n6r3E:F7zBnMy latest?i=R0u6qYMKsI4:gWPh6_n6r3E:V_sGLiP latest?d=qj6IDK7rITs latest?i=R0u6qYMKsI4:gWPh6_n6r3E:gIN9vFwR0u6qYMKsI4
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments