2015年8月13日星期四

Notes for Kali penetration and Version control tools



Version Control
  • RCS: file revisions on single machine
  • CVS: offer extensive archiving and merging capabilities, keeping a central repository somewhere on the network


Penetration Test
  • offline attack : hash crack
    • hash-identifier
    • hashcat (http://hashcat.net/wiki/)
    • rtgen: Rainbow Crack (空間換時間)
      • rtsort
      • rcrack
    • samdump2: crack password of Windows account
    • John (John the Ripper/John)
      • unshadow
      • john
    • C\%windows%\system32/config
    • /etc/shadow, /etc/passwd
    • ophcrack: crack Windows hash

2015年8月4日星期二

[UVa] 524 Prime Ring Problem

運用Backtrack的技巧
一直卡在輸出的最後多出空格,導致PE

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
using namespace std;
int is_prime(int a){
for(int i=2;i*i<=a;i++){
if(a%i==0)return 0;
}
return 1;
}

int sol[20];

void backtrack(int n, int m){
sol[1]=1;
if(n==m+1){
if(!is_prime(sol[1]+sol[m]))return ;
printf("1");
for(int i=2;i<=m;i++)printf(" %d",sol[i]); printf("\n");
return ;
}
for(int i=2;i<=m;i++){
int ok=1;
for(int j=2;j<n;j++){
if(sol[j]==i)ok=0;
}
if(ok){
if(is_prime(i+sol[n-1])){
sol[n]=i;
backtrack(n+1,m);
}
}
}
}
int main(){
freopen("input.txt","r",stdin);
int N,kase=0;
while(scanf("%d",&N)!=EOF){
if(kase++)printf("\n");
//memset(sol,0,sizeof(sol));
printf("Case %d:\n",kase);
backtrack(2,N);

}