Sponsored Content
Full Discussion: Masking of number
Homework and Emergencies Emergency UNIX and Linux Support Masking of number Post 302390193 by mad_man12 on Wednesday 27th of January 2010 06:40:15 AM
Old 01-27-2010
Masking of number

Code:
 
BAT:0310:2009-08-0:Y4   :H:D:00003721:03103721.IFH:00138770:05767:00000000001279'
EXR:CLP:912.570000'
STA:A:9071559:2009-08-10::Wer::Mrs'
DEF::531.97:531.97:310221661617::+ABC:BAL:1:N::::5:40.00:0.00:2009-08-10:CN:1111111111109962::3:N:missc :N:PH:00010833:
0001+ABC:FPT:4:N::::5:19.99:0.00:2009-08-10:CN:1111 1111 1111 9621::3:N:miss c ross:N:AI:00220600:S3IA'
VDI:2004-03-12:133030431725:4:M:00001912:AT:BSP:9124029676:2004-05-06:Parker:4:12:::::I:::::N::129.00:129.00
:1234567887234567678:0:155.40::6:::::+TAX:UB:6.30+TAX:XT:15.10'
CTR:2009-08-10:0.00:0.00:30.00:30.00:7819.00:7819.00'
GTR:11.50:0.00:0.00:28457.81:149449.38:21298.48:154882.82:1725.89'
TRA'

I have a txt file as above and i need to mask the middle digits of the credit card num such that only the first 6
and last 4 are visible.
The credit card number appear in 12th position in +ABC segment separted by :
( the 12th position can have other things also apart from the credit card which shouldn't be masked) the way to
identify credit card num is the field before it that is the 11 field in ABC section is having any of these values
TXE,AF,XT,TT,IT,TX,DX,TY,DT,MO,SE,CF,AXE,DF,CX,TF,DE,XF,CNE,IX,CN,SC,XTE,AX,CX
then credit card is in 12th position and needs to masked
The credit card can be of varying digits (16, 17, 19.........) and they can digits of credit card can appear
together or with space

The credit card number also appear in 26th position in VDI segment separated by :



I got quite a handful solution in the Unix forum but not exactly what i required the code was as below

Code:
awk -F'\+ABC' '{print$1}NF>1{for (i=2;i<=NF;i++)print $i}' OFS=':' |
awk -F: '{if ($27)print $27; else if ($12 ~ /^TXE$|^AF$|^XT$|^TT$|^IT$|^TX$|^DX$|^TY$|^DT$|^MO$|^SE$|^CF$|^AXE$|^DF$|^CX$|^TF$|^DE$|^XF$|^CNE$|^IX$|^CN$|^SC$|^XTE$|^AX$|^CX$/) print $13}' |
awk -F "" '{j=0; for(i=1;i<7+j;i++)if($i==" ")j++; for(;i<=(NF-4);i++)$i="*"}1' OFS=""



i am looking for the replacement in the input file itself such that
the script once run should replace with * in the input file, the above code is giving me separate output and only the masked card number only,

i need the whole file as output with only the cc num being masked.

please advice
Thanks in Advance!!
 

10 More Discussions You Might Find Interesting

1. IP Networking

IP Masking

Is it possible for a internal LAN to mask a IP e.g. i have a server ip running the intranet ip being 192.168.0.8 and i want to make that like www.intranet.com is this possible on a internal network ? (1 Reply)
Discussion started by: perleo
1 Replies

2. Shell Programming and Scripting

Masking Content of a String

Hello, I need to know that whether a content of a string can be hidden or masked inside a shell script. My Sample Code is given below <Code> #!/usr/bin/ksh Userid=test DB=temp Passwd=`java Decryption test` # The Above command will get the encryped password for "test" user id and store... (2 Replies)
Discussion started by: maxmave
2 Replies

3. Shell Programming and Scripting

Data Masking

I have a pipe delimited file that I need to 'mask' to before loading to keep some data confidential. I need to maintain the first 4 bytes of certain columns and replace the remaining bytes with an 'x'. I would like to maintain spaces but it's not a requirement. Example, need to mask columns 2... (2 Replies)
Discussion started by: 1superdork
2 Replies

4. Shell Programming and Scripting

masking issue

Hi I am facing an issue with the below script which has the below line each field being separated with a tab. I need to mask the 8 and 7th field based on following conditions 1. 8th field is 16 in length and is numerics i will mask the middle 6 digits except the first 6 and last 4. input... (2 Replies)
Discussion started by: mad_man12
2 Replies

5. UNIX for Advanced & Expert Users

.htaccess redirect with masking

I am looking to forward the following with masking via my .htaccess file: www.mywebsite.com/origpage www.mywebsite.com/newpage I do not want to forward the entire site, just this one page with masking. Neither page has an extension. I am able to forward with .htaccess - but it does not mask the... (1 Reply)
Discussion started by: globalnerds
1 Replies

6. Programming

Masking Password with *'s

So I've been working on this for some time now and can't seem to find the solution that works for me. I'm working in C/Unix. Basically, I want to take a user input and output something different. For example, I want to take a password and output *'s. In another instance, I want to take inputed... (35 Replies)
Discussion started by: bigdrock44
35 Replies

7. Shell Programming and Scripting

Masking algorithm

I have a requirement of masking few specific fields in the UNIX file. The details are as following- File is fixed length file with each record of 250 charater length. 2 fields needs to be masked – the positions are 21:30 and 110:120 The character by character making needs to be done which... (5 Replies)
Discussion started by: n78298
5 Replies

8. UNIX for Dummies Questions & Answers

Masking data

How Can I mask one particular columns using some unix command? (4 Replies)
Discussion started by: dsa
4 Replies

9. Shell Programming and Scripting

Masking with gsub command

My file "test.dat" data as below Requirement is to mask(replace) all english characters with "X" EXCEPT first 7 characters of every line. my command awk '{gsub("]","X")}1' test.dat looks not working properly, Appreciate any suggestion... (6 Replies)
Discussion started by: JSKOBS
6 Replies

10. Shell Programming and Scripting

Masking Bank Account Number except last 4 digits in the file

Hello Unix Guru's, I need help in the masking Bank Account Number except last 4 digits in the file using either unix command or shell script. I'm greatly appreciate your help. File Name: Sample.txt 560|101012|4267||||||||520114025017|Balance_bank|06/30/2018||||151716.41|AUD... (13 Replies)
Discussion started by: Pradeep R
13 Replies
Vend::Payment::PSiGate(3pm)				User Contributed Perl Documentation			       Vend::Payment::PSiGate(3pm)

NAME
Vend::Payment::PSiGate - Interchange PSiGate Support SYNOPSIS
&charge=psigate or [charge mode=psigate param1=value1 param2=value2] PREREQUISITES
Net::SSLeay or LWP::UserAgent and Crypt::SSLeay Only one of these need be present and working. DESCRIPTION
The Vend::Payment::PSiGate module implements the psigate() routine for use with Interchange. It is compatible on a call level with the other Interchange payment modules. To enable this module, place this directive in "interchange.cfg": Require module Vend::Payment::PSiGate This must be in interchange.cfg or a file included from it. Make sure CreditCardAuto is off (default in Interchange demos). The mode can be named anything, but the "gateway" parameter must be set to "psigate". To make it the default payment gateway for all credit card transactions in a specific catalog, you can set in "catalog.cfg": Variable MV_PAYMENT_MODE psigate It uses several of the standard settings from Interchange payment. Any time we speak of a setting, it is obtained either first from the tag/call options, then from an Interchange order Route named for the mode, then finally a default global payment variable, For example, the "id" parameter would be specified by: [charge mode=psigate id=YourPSiGateMerchantID] or Route psigate id YourPSiGateMerchantID or Variable MV_PAYMENT_ID YourPSiGateMerchantID The active settings are: id Your PSiGate.com account ID, supplied by PSiGate.com when you sign up. Global parameter is MV_PAYMENT_ID. referer A valid referering url (match this with your setting on PSiGate). Global parameter is MV_PAYMENT_REFERER. transaction The type of transaction to be run. Valid values are: Interchange PSiGate Note ---------------- ----------------- --------- auth '1', PreAuth sale '0', Sale settle '2', PostAuth void '9', Void remap This remaps the form variable names to the ones needed by PSiGate. See the "Payment Settings" heading in the Interchange documentation for use. test Set this to "TRUE" if you wish to operate in test mode, i.e. set the PSiGate "x_Test_Request" query paramter to TRUE.i Examples: Route psigate test TRUE or Variable MV_PAYMENT_TEST TRUE or [charge mode=psigate test=TRUE] Troubleshooting Try the instructions above, then enable test mode. A test order should complete. Disable test mode, then test in various PSiGate error modes by using the credit card number 4111 1111 1111 1111. Then try a sale with the card number "4111 1111 1111 1111" and a valid expiration date. The sale should be denied, and the reason should be in [data session payment_error]. If nothing works: o Make sure you "Require"d the module in interchange.cfg: Require module Vend::Payment::PSiGate o Make sure either Net::SSLeay or Crypt::SSLeay and LWP::UserAgent are installed and working. You can test to see whether your Perl thinks they are: perl -MNet::SSLeay -e 'print "It works "' or perl -MLWP::UserAgent -MCrypt::SSLeay -e 'print "It works "' If either one prints "It works." and returns to the prompt you should be OK (presuming they are in working order otherwise). o Check the error logs, both catalog and global. o Make sure you set your payment parameters properly. o Try an order, then put this code in a page: <XMP> [calc] my $string = $Tag->uneval( { ref => $Session->{payment_result} }); $string =~ s/{/{ /; $string =~ s/,/, /g; return $string; [/calc] </XMP> That should show what happened. o If all else fails, Red Hat and other consultants are available to help with integration for a fee. BUGS
There is actually nothing *in* Vend::Payment::PSiGate. It changes packages to Vend::Payment and places things there. AUTHORS
Mark Stosberg <mark@summersault.com>, based on original code by Mike Heins <mheins@redhat.com>. CREDITS
Jeff Nappi <brage@cyberhighway.net> Paul Delys <paul@gi.alaska.edu> webmaster@nameastar.net Ray Desjardins <ray@dfwmicrotech.com> Nelson H. Ferrari <nferrari@ccsc.com> perl v5.14.2 2011-03-09 Vend::Payment::PSiGate(3pm)
All times are GMT -4. The time now is 05:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy