We present here a systematic search for cyanopolyynes in the shock region L1157-B1 and its associated protostar L1157-mm in the framework of the Large Program '' Astrochemical Surveys At IRAM '' ( ASAI ) , dedicated to chemical surveys of solar-type star forming regions with the IRAM 30m telescope . Observations of the millimeter windows between 72 and 272 GHz permitted the detection of HC _ { 3 } N and its 13C isotopologues , and HC _ { 5 } N ( for the first time in a protostellar shock region ) . In the shock , analysis of the line profiles shows that the emission arises from the outflow cavities associated with L1157-B1 and L1157-B2 . Molecular abundances and excitation conditions were obtained from analysis of the Spectral Line Energy Distributions under the assumption of Local Thermodynamical Equilibrium or using a radiative transfer code in the Large Velocity Gradient approximation . Towards L1157mm , the HC _ { 3 } N emission arises from the cold envelope ( T _ { rot } = 10 \hbox { \kern 2.0 ptK } ) and a higher-excitation region ( T _ { rot } = 31 \hbox { \kern 2.0 ptK } ) of smaller extent around the protostar . We did not find any evidence of ^ { 13 } C or D fractionation enrichment towards L1157-B1 . We obtain a relative abundance ratio HC _ { 3 } N/HC _ { 5 } N of 3.3 in the shocked gas . We find an increase by a factor of 30 of the HC _ { 3 } N abundance between the envelope of L1157-mm and the shock region itself . Altogether , these results are consistent with a scenario in which the bulk of HC _ { 3 } N was produced by means of gas phase reactions in the passage of the shock . This scenario is supported by the predictions of a parametric shock code coupled with the chemical model UCL_CHEM .