OXIESEC PANEL
- Current Dir:
/
/
home
/
cubot
/
conf
/
install
/
upgrade
/
upgrade_72_scripts
/
perl_scripts
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/03/2023 07:34:18 AM
rwxr-xr-x
📄
cublib.pl
2.68 KB
02/03/2023 07:34:18 AM
rwxr-xr-x
📄
run.pl
2.46 KB
02/03/2023 07:34:18 AM
rwxr-xr-x
Editing: run.pl
Close
$SQLFILE = "cubout.sql"; open(OUTFILE, ">$SQLFILE") or die "Can't Create SQL File\n"; $CUBOT_DB = $ARGV[0] or die "No DataBase"; #Get All Library Functions In Our Environment require "perl_scripts/cublib.pl"; #Creating Cache for Folder Category my $fcats=`mysql -N $CUBOT_DB -e "select fc_id , gf_id from folder_categories, graph_def where gf_folder=fc_name"`; my @catlist = split('\n', $fcats); %G_Fld_Cat; foreach my $cat(@catlist){ my @catline = split(' ', $cat); my $catid = $catline[0]; my $rptid = $catline[1]; $G_Fld_Cat{$rptid} = $catid; @catline = (); $catid = ""; $rptid= ""; } #Creating Cache for Dashboard my $dash=`mysql -N $CUBOT_DB -e "select df_gf_id from dash_folder"`; my @dashrlist = split(' ', $dash); %G_Dash; foreach my $dashrpt(@dashrlist){ $G_Dash{$dashrpt} = '1'; } #-- Now Start Writing Actual Queries int cubout.sql -- #Create Root For Admin $admfdid = 100000; writesql("--############## Transforming User : admin to Folder Id : $admfdid ############--\n"); create_root('admin', $admfdid, '1'); #Get Userlist from Database $usrs=`mysql -N $CUBOT_DB -e "select lu_id from login_users where lu_id <> 'admin'"`; $root = get_next_id("ft_id","folder_tree","$admfdid"); #Create Root For Each User In Userlist @usrlist = split(' ', $usrs); foreach $uid(@usrlist){ writesql("--############## Transforming User : $uid to Folder Id : $root ############--\n"); create_root("$uid" ,"$root", "$admfdid", "F"); $newroot = $root; #Now Changing Graph Tables $rids = get_graph_def_id($uid, "'V', 'F', 'T'"); @rptids = split(' ', $rids); foreach $rpt(@rptids){ $newroot = $newroot + 1; writesql("----------- Adding For report : $rpt as id : $newroot ---------------\n"); print "Updating User:$uid-($root)\tReport:$rpt-($newroot)\n"; add2_folder_tree("$rpt","$uid","$newroot","$root", (substr($rpt, 0, 1) eq "F")?-1:45, (substr($rpt, 0, 1) eq "F")?0:1, (substr($rpt, 0, 1) eq "T")?1:0); update_graph_tables("$rpt","$uid","$newroot","$root"); #update_series_tables("$rpt","$uid","$newroot","$root"); } $root=$newroot + 1; } #Updating Dash_Folder Table putting ids my $dash=`mysql -N $CUBOT_DB -e "select distinct df_uid, df_dash_name from dash_folder"`; my @dashnames = split('\n', $dash); my $id=1; foreach my $dname(@dashnames){ my @das = split(' ', $dname); $dname =~ s/'//g; writesql("update dash_folder set df_dash_id=$id where df_dash_name='$das[1]' and df_uid='$das[0]';\n"); $id++; $dname = ""; } #mysql -f $CUBOT_DB < cubout.sql close(OUTFILE);