Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Description: El .prox - Password Generator
Submitted on August 27, 2015 at 08:03 PM

Section 1 (C++)

#include <iostream>
#include <fstream>
#include <time.h>
#include <windows.h>
#include <sstream>
using namespace std;

string itos(int r) {
    stringstream n;
    n << r;
    return n.str();
}

string ReplaceString(string &subject, char option, int start, int stop) {
    size_t pos = 0;
    while ((pos = subject.find(option, pos)) != std::string::npos) {
        subject.replace(pos, 1, string(1, (char)(start + (rand() % (start - stop - 1)))));
        pos += 1;
    }
    return subject;
}

int main() {
    srand(time(NULL));
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    while(1) {
        unsigned int anzahl = 0, zeit = time(NULL), lang = 0;

        printf("Wie moechtest du die Passwoerter generieren?:\n1. Automatik\n2. Manuelles System\n");
        char input;
        cin >> input;
        system("cls");

        if(input == '1') {
            printf("Wieviele Passwoerter moechtest du generieren?\n");
            cin >> anzahl;

            printf("Wielang soll ein Passwort sein?\n");
            cin >> lang;

            int start = 0, stop = 0;
            printf("Aus was soll es bestehen:\n1. Zahlen\n2. Kleinbuchstaben\n3. Grossbuchstaben\n4. Zeichen\n5. Alles\n");
            cin >> start;

            switch(start) {

            case 1:
                start = 48;
                stop = 57;
                break;
            case 2:
                start = 97;
                stop = 122;
                break;
            case 3:
                start = 65;
                stop = 90;
                break;
            case 4:
                start = 33;
                stop = 47;
                break;
            case 5:
                start = 33;
                stop = 125;
                break;
            }
            string generiertePassworte = "";
            for(int i = 0; i < anzahl; i++) {
                for(int n = 0; n < lang; n++) {
                    generiertePassworte += (char)(start + (rand() % (start - stop - 1)));
                }
                generiertePassworte += '\n';
            }
            ofstream writer(string(itos(zeit) + ".txt").c_str());
            writer.write(generiertePassworte.c_str(), generiertePassworte.length()-1);
            writer.close();
        } else if(input == '2') {
            printf("Bitte gib das Passwortsystem ein:\n1. n = Ziffer\n2. c = Sonderzeichen\n3. b = Kleinbuchstabe\n4. B = Grossbuchstabe:\n");
            string passwort = "", zeile = "";
            cin >> zeile;

            printf("Wieviele Passwoerter moechstest du generieren?:\n");
            cin >> anzahl;

            for(int i = 0; i < anzahl; i++) {
                passwort += zeile + "\n";
            }

            ReplaceString(passwort, 'n', 48, 57); // Ziffern
            ReplaceString(passwort, 'c', 33, 47); // Zeichen
            ReplaceString(passwort, 'b', 97, 122); // Kleinbuchstabe
            ReplaceString(passwort, 'B', 65, 90); // Großbuchstabe

            ofstream writer(string(itos(zeit) + ".txt").c_str());
            writer.write(passwort.c_str(), passwort.length()-1);
            writer.close();
        }
        cout << "Passwoerter wurden in \"" << zeit << ".txt\" gespeichert!\nNochmal? (Y/N)" << endl;

        cin >> input;
        if(input == 'N' || input == 'n')
            return 0;
        system("cls");
    }
    return 0;
}