first commit

This commit is contained in:
jomu
2013-02-06 22:06:43 +00:00
parent 1a6d3e4c41
commit aef92c311d
84 changed files with 5334 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package de.muehlencord.shared.util;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
*
* @author joern@muehlencord.de
*/
public class DefaultTest {
public String readContentFromFile(String name) throws IOException {
StringBuilder sb = new StringBuilder();
byte[] buffer = new byte[4096];
InputStream is = DefaultTest.class.getResourceAsStream(name);
if (is == null) {
throw new IOException("File " + name + " not found");
}
BufferedInputStream bis = new BufferedInputStream(is);
int bytesRead = 0;
while ((bytesRead = bis.read(buffer)) != -1) {
sb.append(new String(buffer, 0, bytesRead));
}
bis.close();
is.close();
return sb.toString();
}
}

View File

@ -0,0 +1,23 @@
package de.muehlencord.shared.util;
import java.io.IOException;
import java.text.ParseException;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* Basic StringUtilTests
* @author joern@muehlencord.de
*/
public class StringUtilTest extends DefaultTest {
@Test
public void testGetValueBetweenKeywords() throws ParseException, IOException {
String content = readContentFromFile("/test.txt");
String ipAddress = StringUtil.getValueBetweenKeywords(content, "The IP", "has just");
assertEquals ("ipAddress", "222.184.230.118", ipAddress);
}
}

View File

@ -0,0 +1,41 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package de.muehlencord.shared.util.file;
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import org.junit.Test;
/**
*
* @author jomu
*/
public class FileUtilTest {
/**
* tests the function getFilesFromDirectory
* @throws FileHandlingException if the files could not be listed
* @throws URISyntaxException if the testfile specification is wrong
*/
@Test
public void testGetFilesFromDirecotry() throws FileHandlingException, URISyntaxException {
System.out.println("testGetFilesFromDirectory");
URL url = getClass().getResource("/testfile.txt");
File testFile = new File(url.getFile());
List<File> fileList = FileUtil.getFilesFromDirecotry(testFile.getParent(), ".*.java");
Iterator<File> it = fileList.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
}
}

View File

@ -0,0 +1,78 @@
Hi,
The IP 222.184.230.118 has just been banned by Fail2Ban after
4 attempts against ssh.
Here are more information about 222.184.230.118:
% [whois.apnic.net node-4]
% Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
inetnum: 222.184.0.0 - 222.191.255.255
netname: CHINANET-JS
descr: CHINANET jiangsu province network
descr: China Telecom
descr: A12,Xin-Jie-Kou-Wai Street
descr: Beijing 100088
country: CN
admin-c: CH93-AP
tech-c: CJ186-AP
mnt-by: APNIC-HM
mnt-lower: MAINT-CHINANET-JS
mnt-routes: MAINT-CHINANET-JS
remarks: This object can only modify by APNIC hostmaster
remarks: If you wish to modify this object details please
remarks: send email to hostmaster@apnic.net with your
remarks: organisation account name in the subject line.
changed: hm-changed@apnic.net 20040223
status: ALLOCATED PORTABLE
source: APNIC
role: CHINANET JIANGSU
address: 260 Zhongyang Road,Nanjing 210037
country: CN
phone: +86-25-86588231
phone: +86-25-86588745
fax-no: +86-25-86588104
e-mail: ip@jsinfo.net
remarks: send anti-spam reports to spam@jsinfo.net
remarks: send abuse reports to abuse@jsinfo.net
remarks: times in GMT+8
admin-c: CH360-AP
tech-c: CS306-AP
tech-c: CN142-AP
nic-hdl: CJ186-AP
remarks: www.jsinfo.net
notify: ip@jsinfo.net
mnt-by: MAINT-CHINANET-JS
changed: dns@jsinfo.net 20090831
changed: ip@jsinfo.net 20090831
changed: hm-changed@apnic.net 20090901
source: APNIC
changed: hm-changed@apnic.net 20111114
person: Chinanet Hostmaster
nic-hdl: CH93-AP
e-mail: anti-spam@ns.chinanet.cn.net
address: No.31 ,jingrong street,beijing
address: 100032
phone: +86-10-58501724
fax-no: +86-10-58501724
country: CN
changed: dingsy@cndata.com 20070416
mnt-by: MAINT-CHINANET
source: APNIC
Lines containing IP:222.184.230.118 in /var/log/auth.log
Jan 6 23:35:47 localhost sshd[31328]: Invalid user cgi from 222.184.230.118
Jan 6 23:35:49 localhost sshd[31330]: Invalid user richie from 222.184.230.118
Jan 6 23:35:51 localhost sshd[31332]: Invalid user shirsh from 222.184.230.118
Jan 6 23:36:00 localhost sshd[31340]: Invalid user system from 222.184.230.118
Regards,
Fail2Ban

View File

@ -0,0 +1 @@
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.