diff --git a/README.md b/README.md deleted file mode 100644 index 1ae47e2..0000000 --- a/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# SQLIA-dectection-using-internal-query-treess -Java coded program for converting Postgres logs into feature vectors then classifying it as malicious or non malicious using svm - - - -I started working on working a project that would be able to detect SQLIAttacks by going thought database logs. I have throughthly -checked the net and have found many paper concerning the topic. Here what I have done is build a crude way to convert query log(obtained- -from postgres database) to classifiable vectors. I have tested only for select statement(can be done for insert,modify..etc), and -have given a highest accuracy of 94.3% using 10 cross validation in svm, which is really not so much of a great accuracy to achive. - - All are welcome to improve on this, not so great code. - - I have used movielens data for the postgres database (PostgreSQL) 9.6.7 - - The following command is used for downloading the movielens database of users -createdb movielens -curl https://raw.githubusercontent.com/ankane/movielens.sql/master/movielens.sql | psql -d movielens - - -postgresql.conf file has been edited to to get the query-tree in the required format.(you may copy and replace it) - - -The floder website contains a rudementry website coded in html and php used for generating training data. The file create.php is used for -creating username and password for all users in the movielens database. - -Used a tool known SQLMAP for injecting malicious into the website for generating training set malicious query : -https://github.com/sqlmapproject/sqlmap3 - - -weka.jar and weka-src.jar are need to included for using svm classifications - -# Things I wanted to but couldn't do -1.Use histogram model available in Postgres Sql. -2.Add query lenght as 118th feature in the vector used for classification -3.Now the code has to be run separately for malicious and non-malicious queries but can be run parallely and combined. - diff --git a/adwaith.html b/adwaith.html deleted file mode 100644 index e69de29..0000000 diff --git a/gisha.html b/gisha.html new file mode 100644 index 0000000..a4137cf --- /dev/null +++ b/gisha.html @@ -0,0 +1,7 @@ + + + + +

Hello World

+ + diff --git a/hello.c b/hello.c new file mode 100644 index 0000000..33b6a2f --- /dev/null +++ b/hello.c @@ -0,0 +1,5 @@ +#include +void main() +{ +printf("HELLO WORLD"); +} diff --git a/main_project/build.xml b/main_project/build.xml deleted file mode 100644 index c0808b6..0000000 --- a/main_project/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project main_project. - - - diff --git a/main_project/build/classes/.netbeans_automatic_build b/main_project/build/classes/.netbeans_automatic_build deleted file mode 100644 index e69de29..0000000 diff --git a/main_project/build/classes/.netbeans_update_resources b/main_project/build/classes/.netbeans_update_resources deleted file mode 100644 index e69de29..0000000 diff --git a/main_project/build/classes/main_project/Main_project$box.class b/main_project/build/classes/main_project/Main_project$box.class deleted file mode 100644 index c09f85c..0000000 Binary files a/main_project/build/classes/main_project/Main_project$box.class and /dev/null differ diff --git a/main_project/build/classes/main_project/Main_project.class b/main_project/build/classes/main_project/Main_project.class deleted file mode 100644 index 3ae31bf..0000000 Binary files a/main_project/build/classes/main_project/Main_project.class and /dev/null differ diff --git a/main_project/build/classes/main_project/box.class b/main_project/build/classes/main_project/box.class deleted file mode 100644 index 0610f64..0000000 Binary files a/main_project/build/classes/main_project/box.class and /dev/null differ diff --git a/main_project/build/classes/main_project/classify.class b/main_project/build/classes/main_project/classify.class deleted file mode 100644 index a4db6c0..0000000 Binary files a/main_project/build/classes/main_project/classify.class and /dev/null differ diff --git a/main_project/build/classes/main_project/path_to_num.class b/main_project/build/classes/main_project/path_to_num.class deleted file mode 100644 index 988107c..0000000 Binary files a/main_project/build/classes/main_project/path_to_num.class and /dev/null differ diff --git a/main_project/build/classes/main_project/tree_separation.class b/main_project/build/classes/main_project/tree_separation.class deleted file mode 100644 index 1f5c883..0000000 Binary files a/main_project/build/classes/main_project/tree_separation.class and /dev/null differ diff --git a/main_project/manifest.mf b/main_project/manifest.mf deleted file mode 100644 index 328e8e5..0000000 --- a/main_project/manifest.mf +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -X-COMMENT: Main-Class will be added automatically by build - diff --git a/main_project/nbproject/build-impl.xml b/main_project/nbproject/build-impl.xml deleted file mode 100644 index a04ad08..0000000 --- a/main_project/nbproject/build-impl.xml +++ /dev/null @@ -1,1420 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To run this application from the command line without Ant, try: - - java -jar "${dist.jar.resolved}" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - Must select one file in the IDE or set profile.class - This target only works when run from inside the NetBeans IDE. - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set run.class - - - - - - Must select some files in the IDE or set test.includes - - - - - Must select one file in the IDE or set run.class - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - Must select one file in the IDE or set applet.url - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/main_project/nbproject/genfiles.properties b/main_project/nbproject/genfiles.properties deleted file mode 100644 index 93ae079..0000000 --- a/main_project/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=74e752c0 -build.xml.script.CRC32=edd52b72 -build.xml.stylesheet.CRC32=8064a381@1.80.1.48 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=74e752c0 -nbproject/build-impl.xml.script.CRC32=5f86f081 -nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 diff --git a/main_project/nbproject/private/config.properties b/main_project/nbproject/private/config.properties deleted file mode 100644 index e69de29..0000000 diff --git a/main_project/nbproject/private/private.properties b/main_project/nbproject/private/private.properties deleted file mode 100644 index 7cdbf28..0000000 --- a/main_project/nbproject/private/private.properties +++ /dev/null @@ -1,7 +0,0 @@ -application.args=postgresql-2018-03-28_010833.csv -compile.on.save=true -do.depend=false -do.jar=true -javac.debug=true -javadoc.preview=true -user.properties.file=/home/adwaithrk/.netbeans/8.2/build.properties diff --git a/main_project/nbproject/private/private.xml b/main_project/nbproject/private/private.xml deleted file mode 100644 index 4868954..0000000 --- a/main_project/nbproject/private/private.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - file:/home/adwaithrk/NetBeansProjects/main_project/src/main_project/tree_separation.java - file:/home/adwaithrk/NetBeansProjects/main_project/src/main_project/path_to_num.java - file:/home/adwaithrk/NetBeansProjects/main_project/src/main_project/Main_project.java - file:/home/adwaithrk/NetBeansProjects/main_project/src/main_project/classify.java - - - diff --git a/main_project/nbproject/project.properties b/main_project/nbproject/project.properties deleted file mode 100644 index 9808401..0000000 --- a/main_project/nbproject/project.properties +++ /dev/null @@ -1,81 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=false -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -application.title=main_project -application.vendor=adwaithrk -build.classes.dir=${build.dir}/classes -build.classes.excludes=**/*.java,**/*.form -# This directory is removed when the project is cleaned: -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -# Only compile against the classpath explicitly listed here: -build.sysclasspath=ignore -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -# Uncomment to specify the preferred debugger connection transport: -#debug.transport=dt_socket -debug.classpath=\ - ${run.classpath} -debug.test.classpath=\ - ${run.test.classpath} -# Files in build.classes.dir which should be excluded from distribution jar -dist.archive.excludes= -# This directory is removed when the project is cleaned: -dist.dir=dist -dist.jar=${dist.dir}/main_project.jar -dist.javadoc.dir=${dist.dir}/javadoc -endorsed.classpath= -excludes= -file.reference.weka-src.jar=/home/adwaithrk/Downloads/weka-3-8-2/weka-src.jar -file.reference.weka.jar=/home/adwaithrk/Downloads/weka-3-8-2/weka.jar -includes=** -jar.compress=false -javac.classpath=\ - ${libs.HTTPClient.classpath}:\ - ${file.reference.weka.jar}:\ - ${file.reference.weka-src.jar} -# Space-separated list of extra javac options -javac.compilerargs= -javac.deprecation=false -javac.external.vm=true -javac.processorpath=\ - ${javac.classpath} -javac.source=1.8 -javac.target=1.8 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -main.class=main_project.Main_project -manifest.file=manifest.mf -meta.inf.dir=${src.dir}/META-INF -mkdist.disabled=false -platform.active=default_platform -run.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -# Space-separated list of JVM arguments used when running the project. -# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. -# To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs= -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -source.encoding=UTF-8 -src.dir=src -test.src.dir=test diff --git a/main_project/nbproject/project.xml b/main_project/nbproject/project.xml deleted file mode 100644 index 73d8692..0000000 --- a/main_project/nbproject/project.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - org.netbeans.modules.java.j2seproject - - - main_project - - - - - - - - - diff --git a/main_project/src/main_project/Main_project.java b/main_project/src/main_project/Main_project.java deleted file mode 100644 index 39784ca..0000000 --- a/main_project/src/main_project/Main_project.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package main_project; - -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.io.File; -/** - * - * @author adwaithrk - */ -public class Main_project { - - - - /** - * @param args the command line arguments - * @throws java.io.FileNotFoundException - */ - public static void main(String[] args) throws FileNotFoundException, IOException, InterruptedException, Exception { - //System.out.println("hello world"); - // box gh= new box(); - //gh.hello(); - //String read_file_name=args[0]; - String query=new String(); - String[] log=new String[2000000]; - //String[] tree=new String[500000]; - String[] extracted_tree=new String[500000]; - boolean query_start=false; - //int lenght; - int right_brace=0; - int left_brace=0; - int log_count=0; - boolean tryv=false; - //int j; - //boolean contain_jasil; - //boolean contain_movielens; - boolean contain_parse_tree; - //int line_no=0; - int log_i = 0; - int extracted_tree_line_no=0; - String deloc="DEALLOCATE"; - //String read_file_name_path="/home/adwaithrk/project_logs/"; - // "/home/adwaithrk/project_logs/postgresql-2018-03-28_010214.csv" - String file_to_read= "/home/adwaithrk/refined_non_malicious.log"; //postgresql-2018-03-28_213901.log - /*read_file_name_path+read_file_name; */ - //System.out.println(file_to_read); - - - try (FileReader freader = new FileReader(file_to_read)) { - - - BufferedReader br = new BufferedReader(freader); - // String s; - - //log[0]="hello"; - - while((log[log_i] = br.readLine()) != null) { - // System.out.println(log[i]); - //log[i]=s; - - //contain_jasil= log[log_i].toLowerCase().contains("jasil"); - //contain_movielens= log[log_i].toLowerCase().contains("movielens"); - - - contain_parse_tree= log[log_i].toLowerCase().contains("parse tree:"); - //System.out.println(log[log_i]); - - if(/*contain_jasil && contain_movielens &&*/ contain_parse_tree) - { - // System.out.println(log[log_i]+"contains jasil"); - query_start=true; - // System.out.println("parse tree located\n"); - continue; - } - - - - - if(query_start==true) - { - - - if(extracted_tree_line_no==0) - { - // System.out.println("started here"); - extracted_tree[extracted_tree_line_no]=log[log_i].substring(log[log_i].indexOf("{")); - //System.out.println(extracted_tree[extracted_tree_line_no]); - } - - else - { - extracted_tree[extracted_tree_line_no]=log[log_i]; - //System.out.println(extracted_tree[extracted_tree_line_no]); - } - - - extracted_tree_line_no++; - - - - - - - if( log[log_i].contains("{") ) - { - // System.out.println(log[log_i]+"contains {"); - right_brace++; - } - - if( log[log_i].contains("}") ) - { - //System.out.println(log[log_i]+"contains }"); - left_brace++; - } - - - if(right_brace!=0 && left_brace!=0 && right_brace==left_brace) - { - - //System.out.println("going to write the query"); - log_i++; - log[log_i] = br.readLine(); - - log_i++; - log[log_i] = br.readLine(); - //System.out.println(log[log_i]+" is line considered for statement"); - //System.out.println(deloc+"is in the line"); - if(log[log_i].contains(deloc)) - { - // System.out.println("dealloc detected"); - query_start=false; - // System.out.println("log over"); - extracted_tree_line_no=0; - right_brace=left_brace=0; - continue; - - } - - //System.out.println(log[log_i]); - right_brace=left_brace=0; - query_start=false; - - DateFormat df = new SimpleDateFormat("dd_MM_yy_HH_mm_ss"); - Date dateobj = new Date(); - String date_file_name=df.format(dateobj); - // System.out.println(date_file_name); - String Filename_end= date_file_name+"count:"+ ++log_count +".txt"; - String Filename_start="/home/adwaithrk/project_logs_extracted/"; - - final File parent = new File(Filename_start); - - if (!parent.mkdirs()&&!tryv) - { - System.err.println("Could not create parent directories "); - tryv=true; - } - final File log_File = new File(parent, Filename_end); - log_File.createNewFile(); - String File_name=Filename_start+Filename_end; - - // System.out.println(File_name); - File file_log=new File(File_name); - boolean created_file = file_log.createNewFile(); - - - - if(created_file==true) - { - System.out.println("file created"); - } - - - try (FileWriter log_filewriter = new FileWriter(File_name);PrintWriter log_printWriter = new PrintWriter(log_filewriter)) { - - query=log[log_i]; - log_printWriter.println(query); - - for(int i=0;i")) - { - converted_values[h][n] =0; - //System.out.println(converted_values[h][n]); - } - else if(paths_values[h][n].equalsIgnoreCase("r")||paths_values[h][n].equalsIgnoreCase("s")||paths_values[h][n].equalsIgnoreCase("j")||paths_values[h][n].equalsIgnoreCase("f")||paths_values[h][n].equalsIgnoreCase("v")||paths_values[h][n].equalsIgnoreCase("c")) - { - if(paths_values[h][n].equalsIgnoreCase("r") ) - { - converted_values[h][n] =0; - //System.out.println(converted_values[h][n]); - - } - else if(paths_values[h][n].equalsIgnoreCase("s")) - { - converted_values[h][n] =1; - //System.out.println(converted_values[h][n]); - } - else if(paths_values[h][n].equalsIgnoreCase("j")) - { - converted_values[h][n] =2; - //System.out.println(converted_values[h][n]); - } - else if(paths_values[h][n].equalsIgnoreCase("f")) - { - converted_values[h][n] =3; - //System.out.println(converted_values[h][n]); - } - else if(paths_values[h][n].equalsIgnoreCase("v")) - { - converted_values[h][n] =4; - //System.out.println(converted_values[h][n]); - } - else if(paths_values[h][n].equalsIgnoreCase("c")) - { - converted_values[h][n] =5; - // System.out.println(converted_values[h][n]); - } - } - else if(paths_values[h][n].equalsIgnoreCase("?")) - { - converted_values[h][n] =1; - } - - else - { - // System.out.println("all option exhausted....\n checking for constantvalue"); - //System.out.println(paths_values[h][n]); - String[] kl=paths_values[h][n].split(" ",2); - //System.out.println(kl[0]+"is the stuff"); - double nm=Double.parseDouble(kl[0]); - //System.out.println(nm+"is number stuff"); - converted_values[h][n] =nm; - //System.out.println(converted_values[h][n]); - } - - - } - - } - //path_complete_index(); - normalise_array(); - } - - - void path_complete_index() - { - path_tot[0]=1; - path_tot[1]=1; - path_tot[2]=1; - path_tot[3]=1; - path_tot[4]=1; - path_tot[5]=1; - path_tot[6]=1; - path_tot[7]=1; - path_tot[8]=1; - path_tot[9]=1; - path_tot[10]=1; - path_tot[11]=1; - path_tot[12]=1; - path_tot[13]=1; - path_tot[14]=1; - path_tot[15]=1; - path_tot[16]=3; - path_tot[17]=3; - path_tot[18]=9; - path_tot[19]=5; - path_tot[20]=5; - path_tot[21]=5; - path_tot[22]=5; - path_tot[23]=5; - path_tot[24]=5; - path_tot[25]=5; - path_tot[26]=5; - path_tot[27]=5; - path_tot[28]=10; - path_tot[29]=10; - path_tot[30]=5; - path_tot[31]=5; - path_tot[32]=1; - path_tot[33]=1; - path_tot[33]=1; - path_tot[34]=1; - path_tot[35]=1; - path_tot[36]=1; - path_tot[37]=1; - path_tot[38]=1; - path_tot[39]=1; - path_tot[40]=1; - path_tot[41]=1; - path_tot[42]=1; - - - } - - - - - - void normalise_array() throws InterruptedException - { - // path_complete_index(); - System.out.println("Before normalization:"); - for(int y=0;y<43;y++) - { - for(int k=0;k<=paths_values_index[y];k++) - { - System.out.print(converted_values[y][k]); - } - System.out.println(""); - - } - - System.out.println("after normalization:"); - // Thread.sleep(5000); - - for(int y=0;y<43;y++) - { - for(int k=paths_values_index[y]+1;k 0 logs only - # statements running at least this number - # of milliseconds - - -# - What to Log - - -debug_print_parse = on -#debug_print_rewritten = off -#debug_print_plan = on -#debug_pretty_print = on -#log_checkpoints = off -#log_connections = off -#log_disconnections = off -#log_duration = off -#log_error_verbosity = default # terse, default, or verbose messages -#log_hostname = off -log_line_prefix = '' # special values: - # %a = application name - # %u = user name - # %d = database name - # %r = remote host and port - # %h = remote host - # %p = process ID - # %t = timestamp without milliseconds - # %m = timestamp with milliseconds - # %n = timestamp with milliseconds (as a Unix epoch) - # %i = command tag - # %e = SQL state - # %c = session ID - # %l = session line number - # %s = session start timestamp - # %v = virtual transaction ID - # %x = transaction ID (0 if none) - # %q = stop here in non-session - # processes - # %% = '%' - # e.g. '<%u%%%d> ' -#log_lock_waits = off # log lock waits >= deadlock_timeout -#log_statement = 'none' # none, ddl, mod, all -#log_replication_commands = off -#log_temp_files = -1 # log temporary files equal or larger - # than the specified size in kilobytes; - # -1 disables, 0 logs all temp files -log_timezone = 'localtime' - - -# - Process Title - - -cluster_name = '9.6/main' # added to process titles if nonempty - # (change requires restart) -#update_process_title = on - - -#------------------------------------------------------------------------------ -# RUNTIME STATISTICS -#------------------------------------------------------------------------------ - -# - Query/Index Statistics Collector - - -#track_activities = on -#track_counts = on -#track_io_timing = off -#track_functions = none # none, pl, all -#track_activity_query_size = 1024 # (change requires restart) -stats_temp_directory = '/var/run/postgresql/9.6-main.pg_stat_tmp' - - -# - Statistics Monitoring - - -#log_parser_stats = on -#log_planner_stats = off -#log_executor_stats = off -#log_statement_stats = off - - -#------------------------------------------------------------------------------ -# AUTOVACUUM PARAMETERS -#------------------------------------------------------------------------------ - -#autovacuum = on # Enable autovacuum subprocess? 'on' - # requires track_counts to also be on. -#log_autovacuum_min_duration = -1 # -1 disables, 0 logs all actions and - # their durations, > 0 logs only - # actions running at least this number - # of milliseconds. -#autovacuum_max_workers = 3 # max number of autovacuum subprocesses - # (change requires restart) -#autovacuum_naptime = 1min # time between autovacuum runs -#autovacuum_vacuum_threshold = 50 # min number of row updates before - # vacuum -#autovacuum_analyze_threshold = 50 # min number of row updates before - # analyze -#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum -#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze -#autovacuum_freeze_max_age = 200000000 # maximum XID age before forced vacuum - # (change requires restart) -#autovacuum_multixact_freeze_max_age = 400000000 # maximum multixact age - # before forced vacuum - # (change requires restart) -#autovacuum_vacuum_cost_delay = 20ms # default vacuum cost delay for - # autovacuum, in milliseconds; - # -1 means use vacuum_cost_delay -#autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for - # autovacuum, -1 means use - # vacuum_cost_limit - - -#------------------------------------------------------------------------------ -# CLIENT CONNECTION DEFAULTS -#------------------------------------------------------------------------------ - -# - Statement Behavior - - -#search_path = '"$user", public' # schema names -#default_tablespace = '' # a tablespace name, '' uses the default -#temp_tablespaces = '' # a list of tablespace names, '' uses - # only default tablespace -#check_function_bodies = on -#default_transaction_isolation = 'read committed' -#default_transaction_read_only = off -#default_transaction_deferrable = off -#session_replication_role = 'origin' -#statement_timeout = 0 # in milliseconds, 0 is disabled -#lock_timeout = 0 # in milliseconds, 0 is disabled -#idle_in_transaction_session_timeout = 0 # in milliseconds, 0 is disabled -#vacuum_freeze_min_age = 50000000 -#vacuum_freeze_table_age = 150000000 -#vacuum_multixact_freeze_min_age = 5000000 -#vacuum_multixact_freeze_table_age = 150000000 -#bytea_output = 'hex' # hex, escape -#xmlbinary = 'base64' -#xmloption = 'content' -#gin_fuzzy_search_limit = 0 -#gin_pending_list_limit = 4MB - -# - Locale and Formatting - - -datestyle = 'iso, mdy' -#intervalstyle = 'postgres' -timezone = 'localtime' -#timezone_abbreviations = 'Default' # Select the set of available time zone - # abbreviations. Currently, there are - # Default - # Australia (historical usage) - # India - # You can create your own file in - # share/timezonesets/. -#extra_float_digits = 0 # min -15, max 3 -#client_encoding = sql_ascii # actually, defaults to database - # encoding - -# These settings are initialized by initdb, but they can be changed. -lc_messages = 'en_IN' # locale for system error message - # strings -lc_monetary = 'en_IN' # locale for monetary formatting -lc_numeric = 'en_IN' # locale for number formatting -lc_time = 'en_IN' # locale for time formatting - -# default configuration for text search -default_text_search_config = 'pg_catalog.english' - -# - Other Defaults - - -#dynamic_library_path = '$libdir' -#local_preload_libraries = '' -#session_preload_libraries = '' - - -#------------------------------------------------------------------------------ -# LOCK MANAGEMENT -#------------------------------------------------------------------------------ - -#deadlock_timeout = 1s -#max_locks_per_transaction = 64 # min 10 - # (change requires restart) -#max_pred_locks_per_transaction = 64 # min 10 - # (change requires restart) - - -#------------------------------------------------------------------------------ -# VERSION/PLATFORM COMPATIBILITY -#------------------------------------------------------------------------------ - -# - Previous PostgreSQL Versions - - -#array_nulls = on -#backslash_quote = safe_encoding # on, off, or safe_encoding -#default_with_oids = off -#escape_string_warning = on -#lo_compat_privileges = off -#operator_precedence_warning = off -#quote_all_identifiers = off -#sql_inheritance = on -#standard_conforming_strings = on -#synchronize_seqscans = on - -# - Other Platforms and Clients - - -#transform_null_equals = off - - -#------------------------------------------------------------------------------ -# ERROR HANDLING -#------------------------------------------------------------------------------ - -#exit_on_error = off # terminate session on any error? -#restart_after_crash = on # reinitialize after backend crash? - - -#------------------------------------------------------------------------------ -# CONFIG FILE INCLUDES -#------------------------------------------------------------------------------ - -# These options allow settings to be loaded from files other than the -# default postgresql.conf. - -#include_dir = 'conf.d' # include files ending in '.conf' from - # directory 'conf.d' -#include_if_exists = 'exists.conf' # include file only if it exists -#include = 'special.conf' # include file - - -#------------------------------------------------------------------------------ -# CUSTOMIZED OPTIONS -#------------------------------------------------------------------------------ - -# Add settings for extensions here diff --git a/website/create.php b/website/create.php deleted file mode 100644 index 5711106..0000000 --- a/website/create.php +++ /dev/null @@ -1,136 +0,0 @@ -getMessage(); -} - - -$table_query="CREATE TABLE IF NOT EXISTS authenticate( user_id INTEGER PRIMARY KEY UNIQUE NOT NULL REFERENCES users(id), user_name VARCHAR(255) UNIQUE NOT NULL, password VARCHAR(255) NOT NULL, type INTEGER )"; - - - - - - - - -$r=$conn->exec($table_query); - - -if($r !== false){ -echo "
table is created
"; -} -else{ -echo "
table is not created
"; -} - - -$user_count="select count(id) from users"; -$u_count=$conn->query($user_count); - - if($u_count === false){ - echo "Error executing the query"; - } - -//echo "the number of user is".$u_count."
"; - -$plz_count=$u_count->fetch(PDO::FETCH_ASSOC); - -echo "
the number of user is".$plz_count['count']."
"; - -$user_list="select id,zip_code from users"; - -$u_row=$conn->query($user_list); - - -if($u_row === false){ - echo "Error executing the query"; - } - - -$front='A'; -$back='V'; -$us="user"; - - - -while($row = $u_row->fetch(PDO::FETCH_ASSOC)) -{ -echo "
".$row['id']."
"; -echo "
".$row['zip_code']."
"; - -$user_id=$row['id']; - - -$username=$us.$user_id; - -$password=$front.$row['zip_code'].$back; - -echo "user id is".$user_id."
user name is".$username."
password is".$password."
"; - - - -$b="INSERT INTO authenticate VALUES(".$user_id.",'".$username."','".$password."',0)"; - -echo $b; - - -$u_insert=$conn->query($b); - -if($u_insert === false){ - echo "Error executing insert query"; - } -else -{ -echo "executed successfully
"; -} - - -$front++; -$back++; - - -} - -$u_row->commit(); - - - - - - - - -/* - public function createTables() { - - $sqlList = ""; - - $ad= $this->pdo->exec($sqlList);; - - echo "hello" -*/ - - - - -?> diff --git a/website/pro.html b/website/pro.html deleted file mode 100644 index 9dcb19f..0000000 --- a/website/pro.html +++ /dev/null @@ -1,117 +0,0 @@ - - - - - Membership Website Sample - - - - -
-

SAMPLE WEBSITE FOR PROJECT

-
- -
-
- - -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
- - -
-
-
-
- - - - - - - - - diff --git a/website/success_login.php b/website/success_login.php deleted file mode 100644 index b023ef9..0000000 --- a/website/success_login.php +++ /dev/null @@ -1,341 +0,0 @@ - - - - - - - - - - - - - - - -getMessage(); -} - -echo "
welcome user".$id."
" ; - - -$first_q="SELECT movie_id,rating FROM ratings WHERE user_id=".$id; - - - - -$fetch_1=$conn->query($first_q); - -$movies_rated=array(); -$best_movies=array(); -$index_mov=0; - - -$gen_count=array(1,18,0); - -for($i=1;$i<=19;$i++) -{ -$gen_count[$i]=0; -} - - - - - -if($fetch_1 === false){ - die("Error executing the query 1"); - } - -while($row=$fetch_1->fetch(PDO::FETCH_ASSOC)) -{ -$mov_id=$row['movie_id']; -$mov_rating=$row['rating']; - -if($mov_rating>3) -{ - -//echo "best movie is having id =".$mov_id."
"; -$third_q="SELECT genre_id from genres_movies where movie_id=".$mov_id; -$fetch_3=$conn->query($third_q); - -if($fetch_3===false) -{ -die("Error executing the query 3"); - -} -$gen_id=$fetch_3->fetch(PDO::FETCH_ASSOC); - -//echo "its genre id is ".$gen_id['genre_id']; - -$i=$gen_id['genre_id']; - -//echo "genre id-".$i; - -$gen_count[$i]=$gen_count[$i]+1; - -//echo "count is".$gen_count[$i]."
"; - - - - - -} - - - - - - - -/*$ - -else -*/ - -/* -while($row_2=$fetch_2->fetch(PDO::FETCH_ASSOC)) -{ -$mov_name=$row_2['title']; -$movies_rated[]=array("name"=>$mov_id,"rating"=>$mov_rating); - - - - -echo "movie id is ".$mov_id." with rating ".$mov_rating." name is".$mov_name."
"; - -} - - - - - - -} - -*/ - -//echo "movie id is ".$mov_id." with rating ".$mov_rating."
"; - -$second_q="SELECT title from movies where id=".$mov_id; - -//echo $second_q."
"; - -$fetch_2=$conn->query($second_q); - -if($fetch_2 === false){ - die("Error executing the query 2"); - -} - - -while($row_2=$fetch_2->fetch(PDO::FETCH_ASSOC)) -{ -$mov_name=$row_2['title']; -$movies_rated[]=array("name"=>$mov_name,"rating"=>$mov_rating); -//echo "movie id is ".$mov_id." with rating ".$mov_rating." name is".$mov_name."
"; -//echo "movie title is".$mov_name."

"; - -} - - - -} - - - - //echo ''; - - - - - - -//echo "
movies you rated
"; - -echo "
"; - -echo "
"; -echo "
"; - -echo ''; -echo ''; -echo ''; -echo ''; -echo ''; - - -foreach ( $movies_rated as $movie ) { - - //echo '
'; - - echo '
'; - foreach ( $movie as $key => $value ) { - - //echo "
$key
$value
"; - echo ''; - } - echo ''; - //echo ''; -} - - -echo '
MovieRating
'.$value.'
'; - - - - - - - -for($i=1;$i<=18;$i++) -{ -$q_s="SELECT name FROM genres where id=".$i; -$fetch_4=$conn->query($q_s); -$gen_name=$fetch_4->fetch(PDO::FETCH_ASSOC); -//echo $gen_name['name']."has count".$gen_count[$i]; - -} - - -echo "
Top three Rated genres
"; - -echo ''; -echo ''; -echo ''; -echo ''; -echo ''; -echo ''; - - - -for($j=1;$j<=3;$j++) -{ - - -$max=1; -$i=2; - -while($i<=18) -{ -if($gen_count[$i]>$gen_count[$max])$max=$i; -$i++; -} - -$q_s="SELECT name FROM genres where id=".$max; -$fetch_4=$conn->query($q_s); -$gen_name=$fetch_4->fetch(PDO::FETCH_ASSOC); -//echo $gen_name['name'].$j." count".$gen_count[$max]; - -echo ''; -echo ''; -echo ''; -echo ''; -echo ''; - - -$gen_count[$max]=0; - - -} - -echo '
Sl.noGenresRating No
'.$j.''.$gen_name['name'].''.$gen_count[$max].'
'; - - - - - -?> - - - - - - - - - - - - diff --git a/website/welcome.php b/website/welcome.php deleted file mode 100644 index 16c690e..0000000 --- a/website/welcome.php +++ /dev/null @@ -1,95 +0,0 @@ - - - - - -//?php -//session_start(); -//? - -"; -echo "password in variable".$passwrd."
"; - -$query="SELECT * FROM authenticate WHERE user_name='".$name."' AND password='".$passwrd."'"; -//$_SESSION["user_name"]=$name; -//$_SESSION["password"]=$passwrd; -//echo $query; - - - //$host = "host = 127.0.0.1"; - //$port = "port = 5432"; - //$dbname = "dbname = movielens"; - //$credentials = "user = jasil password=test123"; - -//echo "am also here\n"; - - $db = pg_connect("host=localhost dbname=movielens user=jasil password=test123"); - -//echo "am here"; - - if(!$db) { - - echo "Error : Unable to open database
"; - } else { - - // header('Location:https://www.youtube.com/watch?v=QYTmOVeVj24'); - // echo "Opened database successfully
"; - } - - -$result = pg_query($db,$query); - - -if(!$result) -{ -echo "An error occurred...\n"; -exit(); -} -else -{ -$row = pg_fetch_row($result); -if(pg_num_rows($result)==0) -{ - -/* -echo ""; -//header('Location:http://localhost/pro.html'); - -die(); -*/ -} -else -{ -$id=$row[0]; -header('Location:http://localhost/success_login.php?id='.$id); - //header('Location:https://www.youtube.com/watch?v=QYTmOVeVj24'); -echo "id is".$row[0]."user name is".$row[1]."password is".$row[2]."type is".$row[3]."
"; -echo "session id is".$_SESSION["id"]."
"; -//echo "session user name".$_SESSION["user_name"]."
session password is ".$_SESSION["password"]."
session id is".$_SESSION["id"]."
"; - - -} - -} - - - - //echo"helllo\n"; - - // $query=" - - -?> - - diff --git a/weka-src.jar b/weka-src.jar deleted file mode 100644 index ab5ce95..0000000 Binary files a/weka-src.jar and /dev/null differ diff --git a/weka.jar b/weka.jar deleted file mode 100644 index 149d134..0000000 Binary files a/weka.jar and /dev/null differ