]>
git.saurik.com Git - apple/security.git/blob - Security/sec/SOSCircle/CloudKeychainProxy/scripts/tweak 
  10          echo  'Usage: Generate random credit card entries (-c) or autofill (-a). Both can be specified. x will generate a conflict item, K to clear all'   14  args
= `getopt cahxK $*`   15  test   $? 
-eq   0  ||  usage
  22                                             generateCreditCards
= 1 ;   41  test  " $helpme "  -ne  0  &&  usage
  43  if  [  $generateCreditCards  -eq  0  -a  $generateAutofill  -eq  0  -a  $generateConflict  -eq  0  ]   48  # end of option processing   51  exp
= `date "+%Y-%m-%dT%H:%M:%SZ"`   53  # Make up a credit card number   54  amexcc
= `echo  $((RANDOM%372711122299888+372711122299111) )`   55  visacc
= `echo  $((RANDOM%4888123456789888+4888123456789111) )`   56  mccc
= `echo  $((RANDOM%5523123456789888+5523123456789111) )`   57  cclist
=( $amexcc $visacc $mccc )   59  idx
= `echo  $((RANDOM%3+0) )`   61  cctypes
=( "American Express"  "Visa"  "Master Card" )   62  ccnumber
= ${cclist[idx]}   64  ccholders
=( "Sam"  "Ella"  "Alice"  "Bob"  "Mallory"  "Eve" )   65  cardholderName
= ${ccholders[$RANDOM % ${#ccholders[@]} ]}   66  cardholderName
= `hostname | head -c 18`   67  cardholderShortName
= `hostname | head -c 8`   69  cardnamestring
= " $cardholderShortName " "’s " " ${cctypes[idx]} "   71  cat  <<EOF > ccdata.plist   72  <?xml version="1.0" encoding="UTF-8"?>   73  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">   76          <key>CardNameUIString</key>   77          <string> $cardnamestring </string>   79          <string> $ccnumber </string>   80          <key>CardholderName</key>   81          <string> $cardholderName </string>   82          <key>ExpirationDate</key>   88  plutil 
-convert  binary1 
-o  ccdata.bin ccdata.plist
  95  # Create a random credit card item in the keychain   97  if  [  $generateCreditCards  -ne  0  ]   99          security item 
-v -a -f  ccdata.bin class
= genp
, sync
= 1 , acct
= " $uid " , agrp
= "com.apple.safari.credit-cards" , icmt
= "This keychain item is used by Safari to automatically fill credit card information in web forms." , type = 7477 , pdmn
= ak
, svce
= "SafariCreditCardEntries" , labl
= "Safari Credit Card Entry:  $cardnamestring "  100          if  [  "$?"  -ne  "0"  ];  then  101                  echo  "credit card item add failed; is the device locked? "  105  if  [  $generateAutofill  -ne  0  ]  107          `echo  $((RANDOM%9999) ) > tweakpw`  108          email
= ${ccholders[$RANDOM % ${#ccholders[@]} ]}  109          security item 
-v -a -f  tweakpw class
= inet
, acct
= " $email @gmail.com" , agrp
= "com.apple.cfnetwork" , atyp
= form
, desc
= "Web form password" , labl
= "accounts.google.com ( $email @gmail.com)" , pdmn
= ak
, port
= 0 , ptcl
= htps
, srvr
= accounts.google.com
, type = 7477 , sync
= 1  110           if  [  "$?"  -ne  "0"  ];  then  111                  echo  "autofill item add failed; is the device locked? "  115  if  [  $generateConflict  -ne  0  ]  117          `echo "1234" > tweakpw`  119          security item 
-v -a -f  tweakpw class
= inet
, acct
= " $email @gmail.com" , agrp
= "com.apple.cfnetwork" , atyp
= form
, desc
= "Web form password" , labl
= "accounts.google.com ( $email @gmail.com)" , pdmn
= ak
, port
= 0 , ptcl
= htps
, srvr
= accounts.google.com
, type = 7477 , sync
= 1  120           if  [  "$?"  -ne  "0"  ];  then  121                  echo  "conflict item add failed; is the device locked? "  125  if   [  $clearAllItems  -ne  0  ]  127          echo  "Deleting all tweak inet and genp items"  128          security item 
-D  class
= genp
, type = 7477 , sync
= 1 , pdmn
= ak
, svce
= "SafariCreditCardEntries"  129          security item 
-D  class
= inet
, type = 7477 , ptcl
= htps
, srvr
= accounts.google.com
, sync
= 1