Skip to content

Commit 5898715

Browse files
committed
Commit do novo repo
1 parent 503582e commit 5898715

85 files changed

Lines changed: 4103 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM tomcat
2+
3+
COPY . .
4+
5+
RUN apt-get update ; apt-get install maven default-jdk -y ; update-alternatives --config javac
6+
7+
RUN mvn clean package ; cp target/*.war /usr/local/tomcat/webapps/
8+
9+
CMD ["catalina.sh","run"]

LICENSE

Lines changed: 340 additions & 0 deletions
Large diffs are not rendered by default.

azure-pipelines.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Starter pipeline
2+
# Start with a minimal pipeline that you can customize to build and deploy your code.
3+
# Add steps that build, run tests, deploy, and more:
4+
# https://aka.ms/yaml
5+
6+
trigger:
7+
- master
8+
9+
pool:
10+
vmImage: ubuntu-latest
11+
12+
resources:
13+
repositories:
14+
- repository: CheckmarxYamlTemplates
15+
type: git
16+
name: DevSecOps/CheckmarxYamlTemplates
17+
ref: master
18+
19+
variables:
20+
cxTeam: 'CxServer\JornadaIngresso\JIFU'
21+
cxProjectName: '$(Build.DefinitionName)'
22+
23+
24+
steps:
25+
- template: NightlyAsync.AllInOne.yaml@CheckmarxYamlTemplates

dependencia/txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
javavulnlab:
2+
build: .
3+
ports:
4+
- 8080:8080
5+
links:
6+
- mysql
7+
8+
mysql:
9+
image: mysql
10+
environment:
11+
- MYSQL_ROOT_PASSWORD=root

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "SupplyChainSecurity",
3+
"private": false,
4+
"version": "1.0.0",
5+
"description": "SCS Examples to be cautious of... and protected by Checkmarx for...",
6+
"main": "server.js",
7+
"dependencies": {
8+
"handlebars": "4.7.9",
9+
"lodash": "4.17.11",
10+
"node-ipc": "9.2.2",
11+
"ua-parser-js": "0.7.29",
12+
"event-pubsub": "5.0.3",
13+
"momnet": "2.29.1",
14+
"flow-dev-tools": "99.10.9",
15+
"scs": "0.0.1"
16+
},
17+
"scripts": {},
18+
"devDependencies": {
19+
"async": "^2.0.0-rc.4",
20+
"grunt": "^1.0.1",
21+
"qs": "6.0.0",
22+
"js-yaml": "3.6.1"
23+
}
24+
}

pom.xml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>org.cysecurity</groupId>
5+
<artifactId>JavaVulnerableLab</artifactId>
6+
<packaging>war</packaging>
7+
<version>0.0.1-SNAPSHOT</version>
8+
<name>JavaVulnerableLab Maven Webapp</name>
9+
<url>http://maven.apache.org</url>
10+
<dependencies>
11+
<dependency>
12+
<groupId>junit</groupId>
13+
<artifactId>junit</artifactId>
14+
<version>3.8.1</version>
15+
<scope>test</scope>
16+
</dependency>
17+
<dependency>
18+
<groupId>mysql</groupId>
19+
<artifactId>mysql-connector-java</artifactId>
20+
<version>5.1.26</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.json</groupId>
24+
<artifactId>json</artifactId>
25+
<version>20090211</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>javax.servlet</groupId>
29+
<artifactId>jstl</artifactId>
30+
<version>1.2</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.hibernate</groupId>
34+
<artifactId>hibernate-core</artifactId>
35+
<version>4.0.1.Final</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>javax.servlet</groupId>
39+
<artifactId>servlet-api</artifactId>
40+
<version>2.3</version>
41+
<scope>provided</scope>
42+
</dependency>
43+
</dependencies>
44+
<build>
45+
<finalName>JavaVulnerableLab</finalName>
46+
</build>
47+
</project>
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
7+
package org.cysecurity.cspf.jvl.controller;
8+
9+
import java.io.BufferedWriter;
10+
import java.io.File;
11+
import java.io.FileWriter;
12+
import java.io.IOException;
13+
import java.io.PrintWriter;
14+
import javax.servlet.ServletException;
15+
import javax.servlet.http.HttpServlet;
16+
import javax.servlet.http.HttpServletRequest;
17+
import javax.servlet.http.HttpServletResponse;
18+
19+
/**
20+
*
21+
* @author breakthesec
22+
*/
23+
public class AddPage extends HttpServlet {
24+
25+
/**
26+
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
27+
* methods.
28+
*
29+
* @param request servlet request
30+
* @param response servlet response
31+
* @throws ServletException if a servlet-specific error occurs
32+
* @throws IOException if an I/O error occurs
33+
*/
34+
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
35+
throws ServletException, IOException {
36+
response.setContentType("text/html;charset=UTF-8");
37+
PrintWriter out = response.getWriter();
38+
try {
39+
String fileName=request.getParameter("filename");
40+
String content=request.getParameter("content");
41+
if(fileName!=null && content!=null)
42+
{
43+
String pagesDir=getServletContext().getRealPath("/pages");
44+
String filePath=pagesDir+"/"+fileName;
45+
File f=new File(filePath);
46+
if(f.exists())
47+
{
48+
f.delete();
49+
}
50+
if(f.createNewFile())
51+
{
52+
BufferedWriter bw=new BufferedWriter(new FileWriter(f.getAbsoluteFile()));
53+
bw.write(content);
54+
bw.close();
55+
out.print("Successfully created the file: <a href='../pages/"+fileName+"'>"+fileName+"</a>");
56+
}
57+
else
58+
{
59+
out.print("Failed to create the file");
60+
}
61+
}
62+
else
63+
{
64+
out.print("filename or content Parameter is missing");
65+
}
66+
67+
}
68+
catch(Exception e)
69+
{
70+
out.print(e);
71+
}
72+
finally {
73+
out.close();
74+
}
75+
}
76+
77+
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
78+
/**
79+
* Handles the HTTP <code>GET</code> method.
80+
*
81+
* @param request servlet request
82+
* @param response servlet response
83+
* @throws ServletException if a servlet-specific error occurs
84+
* @throws IOException if an I/O error occurs
85+
*/
86+
@Override
87+
protected void doGet(HttpServletRequest request, HttpServletResponse response)
88+
throws ServletException, IOException {
89+
processRequest(request, response);
90+
}
91+
92+
/**
93+
* Handles the HTTP <code>POST</code> method.
94+
*
95+
* @param request servlet request
96+
* @param response servlet response
97+
* @throws ServletException if a servlet-specific error occurs
98+
* @throws IOException if an I/O error occurs
99+
*/
100+
@Override
101+
protected void doPost(HttpServletRequest request, HttpServletResponse response)
102+
throws ServletException, IOException {
103+
processRequest(request, response);
104+
}
105+
106+
/**
107+
* Returns a short description of the servlet.
108+
*
109+
* @return a String containing servlet description
110+
*/
111+
@Override
112+
public String getServletInfo() {
113+
return "Short description";
114+
}// </editor-fold>
115+
116+
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
7+
package org.cysecurity.cspf.jvl.controller;
8+
9+
import java.io.IOException;
10+
import java.io.PrintWriter;
11+
import java.sql.Connection;
12+
import java.sql.ResultSet;
13+
import java.sql.Statement;
14+
import javax.servlet.ServletException;
15+
import javax.servlet.http.HttpServlet;
16+
import javax.servlet.http.HttpServletRequest;
17+
import javax.servlet.http.HttpServletResponse;
18+
import org.cysecurity.cspf.jvl.model.DBConnect;
19+
import org.json.JSONObject;
20+
21+
/**
22+
*
23+
* @author breakthesec
24+
*/
25+
public class EmailCheck extends HttpServlet {
26+
27+
/**
28+
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
29+
* methods.
30+
*
31+
* @param request servlet request
32+
* @param response servlet response
33+
* @throws ServletException if a servlet-specific error occurs
34+
* @throws IOException if an I/O error occurs
35+
*/
36+
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
37+
throws ServletException, IOException {
38+
response.setContentType("application/json");
39+
PrintWriter out = response.getWriter();
40+
try {
41+
Connection con=new DBConnect().connect(getServletContext().getRealPath("/WEB-INF/config.properties"));
42+
String email=request.getParameter("email").trim();
43+
JSONObject json=new JSONObject();
44+
if(con!=null && !con.isClosed())
45+
{
46+
ResultSet rs=null;
47+
Statement stmt = con.createStatement();
48+
rs=stmt.executeQuery("select * from users where email='"+email+"'");
49+
if (rs.next())
50+
{
51+
json.put("available", "1");
52+
}
53+
else
54+
{
55+
json.put("available", new Integer(0));
56+
}
57+
}
58+
out.print(json);
59+
}
60+
catch(Exception e)
61+
{
62+
out.print(e);
63+
}
64+
finally {
65+
out.close();
66+
}
67+
}
68+
69+
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
70+
/**
71+
* Handles the HTTP <code>GET</code> method.
72+
*
73+
* @param request servlet request
74+
* @param response servlet response
75+
* @throws ServletException if a servlet-specific error occurs
76+
* @throws IOException if an I/O error occurs
77+
*/
78+
@Override
79+
protected void doGet(HttpServletRequest request, HttpServletResponse response)
80+
throws ServletException, IOException {
81+
processRequest(request, response);
82+
}
83+
84+
/**
85+
* Handles the HTTP <code>POST</code> method.
86+
*
87+
* @param request servlet request
88+
* @param response servlet response
89+
* @throws ServletException if a servlet-specific error occurs
90+
* @throws IOException if an I/O error occurs
91+
*/
92+
93+
protected void doPost(HttpServletRequest request, HttpServletResponse response)
94+
throws ServletException, IOException {
95+
processRequest(request, response);
96+
}
97+
98+
/**
99+
* Returns a short description of the servlet.
100+
*
101+
* @return a String containing servlet description
102+
*/
103+
@Override
104+
public String getServletInfo() {
105+
return "Short description";
106+
}// </editor-fold>
107+
108+
}

0 commit comments

Comments
 (0)