Turkhackteam.net/org - Turkish Hacking & Security Platform  
Geri git   Turkhackteam.net/org - Turkish Hacking & Security Platform >
Programlama
> Java

Java Object Oriented Programming temeline dayanan, çok işlevli, step by step işleyen dilin dökümanlarının paylaşım alanı.




Java İle Otomatik Şifre Üretimi

Java

Yeni Konu aç Cevapla
 
Seçenekler
Alt 27-09-2008 15:21   #1
  • Binbaşı
  • Üye Bilgileri
Üyelik tarihi
09/2008
Nereden
BuRs4
Mesajlar
Konular

Teşekkür (Etti): 0
Teşekkür (Aldı): 547


Thumbs down Java İle Otomatik Şifre Üretimi



Artik güvenli ve istediginiz uzunluk ve charecter özellikleri tasiyan sifre genere edebilirsiniz

Kod:
//1.File: GUI.java


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


public class GUI implements MouseListener{

private JFrame frame = null;
private JCheckBox chkBox1 = null;
private JCheckBox chkBox2 = null;
private JCheckBox chkBox3 = null;
private JCheckBox chkBox4 = null;
private JCheckBox chkBox5 = null;
private JTextField txtAnzahlZeichen = null;
private JTextField txtAnzahlPW = null;
private JButton cmdStart = null;
private JPanel panel1 = null;
private JPanel panel2 = null;
private JPanel mainPanel = null;
private JLabel lblTitel1 = null;
private JLabel lblTitel2 = null;

public GUI() {
frame = new JFrame("PWCreator");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.setResizable(false);

chkBox1 = new JCheckBox("a-z");
chkBox2 = new JCheckBox("A-Z");
chkBox3 = new JCheckBox("0-9");
chkBox4 = new JCheckBox("ozel isaretler");
chkBox5 = new JCheckBox("hepsi");

txtAnzahlZeichen = new JTextField();
txtAnzahlPW = new JTextField();

lblTitel1 = new JLabel("Sifrenin uzunlugu");
lblTitel2 = new JLabel("Sifrenin adeti");

cmdStart = new JButton("baslat");
cmdStart.addMouseListener(this);

panel1 = new JPanel(new GridLayout(5, 1));
panel2 = new JPanel(new GridLayout(5, 1));
mainPanel = new JPanel(new GridLayout(1, 2));

panel1.add(chkBox1);
panel1.add(chkBox2);
panel1.add(chkBox3);
panel1.add(chkBox4);
panel1.add(chkBox5);

panel2.add(lblTitel1);
panel2.add(txtAnzahlZeichen);
panel2.add(lblTitel2);
panel2.add(txtAnzahlPW);
panel2.add(cmdStart);

mainPanel.add(panel1);
mainPanel.add(panel2);

frame.setContentPane(mainPanel);
frame.pack();
frame.setVisible(true);


}

public **** mousePressed(MouseEvent e) {
Object source = e.getSource();
CreatePW createPW = null;

if(source == cmdStart) {
try {
int laengePW = Integer.parseInt(txtAnzahlZeichen.getText());
int anzahlPW = Integer.parseInt(txtAnzahlPW.getText());
createPW = new CreatePW("Temp.txt", laengePW, anzahlPW);

if(chkBox1.isSelected()) {
createPW.kleinbuchstaben();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox2.isSelected()) {
createPW.grossbuchstaben();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox3.isSelected()) {
createPW.zahlen();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox4.isSelected()) {
createPW.sonderzeichen();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}else if(chkBox5.isSelected()) {
createPW.alle();
JOptionPane.showMessageDialog(null, "Sifre basariyla olusturulmustur!", "Information", JOptionPane.INFORMATION_MESSAGE);
}
}catch(Exception exception) {
JOptionPane.showMessageDialog(null, exception.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
}


}
public **** mouseClicked(MouseEvent e) {}
public **** mouseEntered(MouseEvent e) {}
public **** mouseExited(MouseEvent e) {}
public **** mouseReleased(MouseEvent e) {}


}


//2.File: CreatePW.java

import java.io.*;

public class CreatePW {

private String fileName = null;
private int anzahlPW = 0;
private int laengePW = 0;
private FileWriter fileWriter = null;
private BufferedWriter bufferedWriter = null;

public CreatePW(String fileName, int laengePW, int anzahlPW) throws Exception {
this.fileName = fileName;

if(laengePW <= 0 || anzahlPW <1) {
throw new IllegalArgumentException();
}
this.laengePW = laengePW;
this.anzahlPW = anzahlPW;
}

public **** grossbuchstaben() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);

for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 65 && zahl <= 90){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();


}

public **** kleinbuchstaben() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);

for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 97 && zahl <= 122){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();

}

public **** zahlen() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);

for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 48 && zahl <= 57){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}

public **** sonderzeichen() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);

for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if((zahl >= 32 && zahl <= 47)|| (zahl >=58 && zahl <=64) || (zahl >= 91 && zahl <= 96) || (zahl >= 123 && zahl <= 126)){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();

}

public **** alle() throws Exception {
double zahl = 0.0;
fileWriter = new FileWriter(fileName);
bufferedWriter = new BufferedWriter(fileWriter);

for(int i = 0; i < anzahlPW; i++) {
for(int j = 0; j < laengePW; j++) {
zahl = Math.random();
zahl = zahl * 1000;
zahl = (int) zahl;
if(zahl >= 32 && zahl <= 126){
bufferedWriter.write( (char) zahl);
}else {
j = j - 1;
}
}
bufferedWriter.newLine();
}
bufferedWriter.close();
fileWriter.close();
}


}


//3.File: Sub.java

public class Sub {
public static **** main (String[] args) {
new GUI();

}
}


#####################################



___________________________________________

§§§§§§§§§_§§§___§§§_§§§§§§§§§_§§§__§§§
___§§§____§§§___§§§_§§§___§§§_§§§_§§§_
___§§§____§§§___§§§_§§§§§§§§§_§§§§§§_
___§§§____§§§___§§§_§§§__§§§__§§§_§§§
___§§§____§§§§§§§§§_§§§___§§§_§§§__§§§
 Offline  
 
Alıntı ile Cevapla
Cevapla

Bookmarks

Seçenekler


Bilgilendirme Turkhackteam.net/org
Sitemizde yer alan konular üyelerimiz tarafından paylaşılmaktadır.
Bu konular yasalara uygunluk ve telif hakkı konusunda yönetimimiz tarafından kontrol edilse de, gözden kaçabilen içerikler yer alabilmektedir.
Bu tür konuları turkhackteamiletisim [at] gmail.com mail adresimize bildirebilirsiniz, konular hakkında en kısa sürede gerekli işlemler yapılacaktır.
Please Report Abuse, DMCA, Harassment, Scamming, Warez, Crack, Divx, Mp3 or any Illegal Activity to turkhackteamiletisim [at] gmail.com

Türkhackteam saldırı timleri Türk sitelerine hiçbir zararlı faaliyette bulunmaz.
Türkhackteam üyelerinin yaptığı bireysel hack faaliyetlerinden Türkhackteam sorumlu değildir. Sitelerinize Türkhackteam ismi kullanılarak hack faaliyetinde bulunulursa, site-sunucu erişim loglarından bu faaliyeti gerçekleştiren ip adresini tespit edip diğer kanıtlarla birlikte savcılığa suç duyurusunda bulununuz.



         

Powered by vBulletin® Copyright ©2000 - 2019

TSK Mehmetçik Vakfı

Türk Polis Teşkilatını Güçlendirme Vakfı

Google+

web tasarım

wau